From owner-freebsd-bugs@FreeBSD.ORG Thu Apr 26 16:40:11 2012 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DBCD61065675 for ; Thu, 26 Apr 2012 16:40:10 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id AE6738FC14 for ; Thu, 26 Apr 2012 16:40:10 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q3QGeACw077889 for ; Thu, 26 Apr 2012 16:40:10 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q3QGeAqg077888; Thu, 26 Apr 2012 16:40:10 GMT (envelope-from gnats) Resent-Date: Thu, 26 Apr 2012 16:40:10 GMT Resent-Message-Id: <201204261640.q3QGeAqg077888@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Jim Pirzyk Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 25C5C106566C for ; Thu, 26 Apr 2012 16:38:41 +0000 (UTC) (envelope-from pirzyk@home.pirzyk.org) Received: from mail.vagrantaristocrat.net (mail.vagrantaristocrat.net [50.56.204.87]) by mx1.freebsd.org (Postfix) with ESMTP id EA62F8FC12 for ; Thu, 26 Apr 2012 16:38:40 +0000 (UTC) Received: from 209-6-36-209.c3-0.smr-ubr1.sbo-smr.ma.cable.rcn.com ([209.6.36.209]:56059 helo=amigo.home.pirzyk.org) by hargrave.vagrantaristocrat.net with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.77) (envelope-from ) id 1SNR0m-00046O-9m for FreeBSD-gnats-submit@freebsd.org; Thu, 26 Apr 2012 10:53:40 -0500 Received: from freebsd.home.pirzyk.org (freebsd.home.pirzyk.org [192.168.1.4]) by amigo.home.pirzyk.org (8.14.4/8.14.4) with ESMTP id q3QFrcZa044089 for ; Thu, 26 Apr 2012 11:53:38 -0400 (EDT) (envelope-from pirzyk@freebsd.home.pirzyk.org) Received: (from pirzyk@localhost) by freebsd.home.pirzyk.org (8.14.5/8.14.5/Submit) id q3QFrchr013728; Thu, 26 Apr 2012 11:53:38 -0400 (EDT) (envelope-from pirzyk) Message-Id: <201204261553.q3QFrchr013728@freebsd.home.pirzyk.org> Date: Thu, 26 Apr 2012 11:53:38 -0400 (EDT) From: Jim Pirzyk To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: bin/167336: pkg_info can't determine what package a missing file is related to X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Jim Pirzyk List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Apr 2012 16:40:11 -0000 >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 root@farrell.cse.buffalo.edu:/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 >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: