Skip site navigation (1)Skip section navigation (2)
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>

next in thread | raw e-mail | index | archive | help

--H1spWtNR+x+ondvy
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

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.

--H1spWtNR+x+ondvy
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=patch-pkg_version

--- 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('!')) {

--H1spWtNR+x+ondvy--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060212145150.GB40333>