From nobody@FreeBSD.org  Mon Sep  9 13:07:47 2002
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id CB48637B4FD
	for <freebsd-gnats-submit@FreeBSD.org>; Mon,  9 Sep 2002 13:07:46 -0700 (PDT)
Received: from www.freebsd.org (www.FreeBSD.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 50B5543E42
	for <freebsd-gnats-submit@FreeBSD.org>; Mon,  9 Sep 2002 13:07:46 -0700 (PDT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.12.4/8.12.4) with ESMTP id g89K7jOT022132
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 9 Sep 2002 13:07:45 -0700 (PDT)
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.12.4/8.12.4/Submit) id g89K7jUj022131;
	Mon, 9 Sep 2002 13:07:45 -0700 (PDT)
Message-Id: <200209092007.g89K7jUj022131@www.freebsd.org>
Date: Mon, 9 Sep 2002 13:07:45 -0700 (PDT)
From: Jeff King <peff-freebsd@peff.net>
To: freebsd-gnats-submit@FreeBSD.org
Subject: pkg_info -qg doesn't handle missing files well
X-Send-Pr-Version: www-1.0

>Number:         42609
>Category:       bin
>Synopsis:       pkg_info -qg doesn't handle missing files well
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    krion
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Sep 09 13:10:01 PDT 2002
>Closed-Date:    Sat Sep 24 19:43:35 GMT 2005
>Last-Modified:  Sat Sep 24 19:43:35 GMT 2005
>Originator:     Jeff King
>Release:        4.6.2
>Organization:
>Environment:
FreeBSD segfault.intra 4.6.2-RELEASE FreeBSD 4.6.2-RELEASE #0: Mon Sep  9 03:31:47 EDT 2002     root@segfault.intra:/usr/obj/usr/src/sys/SEGFAULT  i386
>Description:
 When using pkg_info -qg <package>, one can obtain a list of files which fail the MD5 checksum. A list of files of the form "<file> fails the original MD5 checksum\n" will be output to stdout. If a file is missing, however, it is *not* listed as failing the checksum. Instead, the following message is printed to stderr: "pkg_info: <file> doesn't exist\n\n".

While the semantics of "failing an MD5 checksum" may be up for debate (does a missing file fail because it is missing?) it seems that the intent of the -g option is to do an integrity check on the package. Missing files are clearly an integrity problem, but parsing the stdout of pkg_info -g will not include them.
>How-To-Repeat:
Choose a file from an installed package. Move the file to a backup area. Run pkg_info -qg <package>.
>Fix:
      My suggestion, therefore, is to do away with the stderr message in the case of a missing file, and instead output a message to stdout of the form "<file> does not exist".

The change is actually a one liner. Change /usr/src/usr.sbin/pkg_install/info/show.c:283 from
warnx("%s doesn't exist\n", tmp);
to
printf("%s does not exist\n", tmp);

As an aside, even if this change is not accepted, the '\n' in the warnx is redundant and should be removed.
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->krion 
Responsible-Changed-By: flz 
Responsible-Changed-When: Fri Aug 19 12:36:50 GMT 2005 
Responsible-Changed-Why:  
Bug krion with pkg_install PRs. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=42609 
State-Changed-From-To: open->closed 
State-Changed-By: krion 
State-Changed-When: Sat Sep 24 19:42:07 GMT 2005 
State-Changed-Why:  
I committed the partitial part of this PR, and removed 'n' while 
running 'pkg_info -qg' and files don't exist. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=42609 
>Unformatted:
