Date: Sun, 12 Feb 2006 15:51:50 +0100 From: Sebastian Stach <sebsta@t-online.de> To: freebsd-stable@freebsd.org Subject: problem with pkg_version Message-ID: <20060212145150.GB40333@sebsta.dialin.t-online.de>
index | next in thread | raw e-mail
[-- Attachment #1 --]
When using pkg_version with the -o argument to print the origin
instead of the package name it doesn't work correct.
# pkg_version -o
(output stripped)
x11/xorg =
x11/xorg =
x11/xorg =
(output stripped)
The output should be:
# pkg_version -o
(output stripped)
x11/xorg =
x11/xorg-clients =
x11/xorg-documents =
(output stripped)
Looking at the code in "/usr/src/usr.sbin/pkg_install/version/perform.c"
in function "show_version" pkg_version removes everything after the last
"-" from the origin.
if (ShowOrigin != FALSE)
strlcpy(tmp, plist.origin, PATH_MAX);
else
strlcpy(tmp, plist.name, PATH_MAX);
if (!Verbose) {
if ((ch = strrchr(tmp, '-')) != NULL)
ch[0] = '\0';
}
I think this shouldn't be done in the "ShowOrigin" case.
The attached patch fixed it for me.
[-- Attachment #2 --]
--- usr.sbin/pkg_install/version/perform.c.orig Sun Feb 12 14:43:48 2006
+++ usr.sbin/pkg_install/version/perform.c Sun Feb 12 14:51:59 2006
@@ -261,11 +261,12 @@
return;
if (ShowOrigin != FALSE)
strlcpy(tmp, plist.origin, PATH_MAX);
- else
+ else {
strlcpy(tmp, plist.name, PATH_MAX);
- if (!Verbose) {
- if ((ch = strrchr(tmp, '-')) != NULL)
- ch[0] = '\0';
+ if (!Verbose) {
+ if ((ch = strrchr(tmp, '-')) != NULL)
+ ch[0] = '\0';
+ }
}
if (latest == NULL) {
if (source == NULL && OUTPUT('!')) {
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060212145150.GB40333>
