>Number:         167336
>Category:       bin
>Synopsis:       pkg_info can't determine what package a missing file is 
>related to
>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:   Thu Apr 26 16:40:10 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Jim Pirzyk
>Release:        FreeBSD 9.0-RELEASE amd64
>Organization:
>Environment:
System: FreeBSD freebsd.home.pirzyk.org 9.0-RELEASE FreeBSD 9.0-RELEASE #0: Tue 
Jan 3 07:46:30 UTC 2012 
[email protected]:/usr/obj/usr/src/sys/GENERIC amd64

>Description:
        Can't programmatically determine the package that is related to the 
'pkg_info -g' output like:

/usr/local/foo/bar/baz.txt doesn't exist

        This is because the "doesn't exist" line was written out using STDERR 
whereas the lines:

Information for pkg-1.2.3:

        was written out using STDOUT.  If you combine the output streams in a 
perl script ala:

open ($FP, "/usr/sbin/pkg_info -a -g 2>&1 |" ) ...

        then the order is undefined and you can't associate the "doesn't exist" 
line with the "Information for" line.
        Furthermore if you try to use the -W option on pkg_info, it does not 
process the file and just gives you the error:

pkg_info: /usr/local/foo/bar/baz.txt: file cannot be found

>How-To-Repeat:
        Remove a file from a package and then run:

pkg_info -a -g | cat

        and try to determine which package the missing file is from.  Then run:

pkg_info -W <DELETED_FILE>

>Fix:

--- ./pkg_install/info/show.c.orig      2012-01-02 22:25:51.000000000 -0500
+++ ./pkg_install/info/show.c   2012-04-26 11:21:58.039342463 -0400
@@ -330,7 +330,7 @@
        } else if (p->type == PLIST_FILE) {
            snprintf(tmp, FILENAME_MAX, "%s/%s", dir, p->name);
            if (!fexists(tmp))
-               warnx("%s doesn't exist", tmp);
+               printf("%s doesn't exist\n", tmp);
            else if (p->next && p->next->type == PLIST_COMMENT &&
                     (strncmp(p->next->name, "MD5:", 4) == 0)) {
                char *cp = NULL, buf[33];
--- ./pkg_install/info/perform.c.orig   2012-01-02 22:25:51.000000000 -0500
+++ ./pkg_install/info/perform.c        2012-04-26 11:44:29.951086716 -0400
@@ -359,8 +359,6 @@
            }
            free(tmp);
        }
-       if (wp->skip == TRUE)
-           warnx("%s: %s", wp->file, msg);
     }
 
     installed = matchinstalled(MATCH_ALL, NULL, &errcode);
@@ -390,8 +388,6 @@
                cwd = itr->name;
            } else if (itr->type == PLIST_FILE) {
                TAILQ_FOREACH(wp, which_list, next) {
-                   if (wp->skip == TRUE)
-                       continue;
                    if (!cmp_path(wp->file, itr->name, cwd))
                        continue;
                    if (wp->package[0] != '\0') {


>Release-Note:
>Audit-Trail:
>Unformatted:
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "[email protected]"

Reply via email to