bin/76858: [PATCH] Bug in pkg_{install,delete} package name lookup

Matthew D.Fuller fullermd at over-yonder.net
Sun Jan 30 07:00:48 PST 2005


>Number:         76858
>Category:       bin
>Synopsis:       [PATCH] Bug in pkg_{install,delete} package name lookup
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jan 30 15:00:42 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Matthew D. Fuller
>Release:        FreeBSD 5.3-STABLE i386
>Organization:
>Environment:
System: FreeBSD mortis.sighup.org 5.3-STABLE FreeBSD 5.3-STABLE #0: Sat Jan 29 00:29:15 CST 2005 fullermd at mortis:/usr/obj/usr/src/sys/MORTIS i386


>Description:
    The code in pkg_* that dissects a full path to get a package name out
    of it doesn't take account of packages that start with numbers, even
    though it should, and the comment says it does.

>How-To-Repeat:
    (ttyp3):{267}% pkg_info /var/db/pkg/3dc-0.8.1/
    pkg_info: can't find package 'pkg' installed or in a file!

>Fix:

Index: delete/main.c
===================================================================
RCS file: /usr/cvs/src/usr.sbin/pkg_install/delete/main.c,v
retrieving revision 1.26
diff -u -r1.26 main.c
--- delete/main.c	29 Jun 2004 18:54:47 -0000	1.26
+++ delete/main.c	30 Jan 2005 14:48:29 -0000
@@ -121,7 +121,7 @@
 		 * package name.  Otherwise we've come across a trailing '/' and
 		 * need to continue our quest.
 		 */
-		if (isalpha(*pkgs_split) || ((MatchType == MATCH_GLOB) && \
+		if (isalnum(*pkgs_split) || ((MatchType == MATCH_GLOB) && \
 		    strpbrk(pkgs_split, "*?[]") != NULL)) {
 		    *argv = pkgs_split;
 		    break;
Index: info/main.c
===================================================================
RCS file: /usr/cvs/src/usr.sbin/pkg_install/info/main.c,v
retrieving revision 1.47
diff -u -r1.47 main.c
--- info/main.c	18 Oct 2004 05:34:54 -0000	1.47
+++ info/main.c	30 Jan 2005 14:48:51 -0000
@@ -240,7 +240,7 @@
 		 * we've come across a trailing '/' and need to continue our
 		 * quest.
 		 */
-		if (isalpha(*pkgs_split) || ((MatchType == MATCH_GLOB) && \
+		if (isalnum(*pkgs_split) || ((MatchType == MATCH_GLOB) && \
 		    strpbrk(pkgs_split, "*?[]") != NULL)) {
 		    *argv = pkgs_split;
 		    break;
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list