Date: Mon, 9 Sep 2002 13:07:45 -0700 (PDT) From: Jeff King <peff-freebsd@peff.net> To: freebsd-gnats-submit@FreeBSD.org Subject: bin/42609: pkg_info -qg doesn't handle missing files well Message-ID: <200209092007.g89K7jUj022131@www.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 42609
>Category: bin
>Synopsis: pkg_info -qg doesn't handle missing files well
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Mon Sep 09 13:10:01 PDT 2002
>Closed-Date:
>Last-Modified:
>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:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200209092007.g89K7jUj022131>
