problem with pkg_version
Sebastian Stach
sebsta at t-online.de
Sun Feb 12 06:51:59 PST 2006
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.
-------------- next part --------------
--- 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('!')) {
More information about the freebsd-stable
mailing list