NetBSD Problem Report #54726

From www@netbsd.org  Sun Dec  1 06:21:30 2019
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 2EF8C7A160
	for <gnats-bugs@gnats.NetBSD.org>; Sun,  1 Dec 2019 06:21:30 +0000 (UTC)
Message-Id: <20191201062129.457F97A1AE@mollari.NetBSD.org>
Date: Sun,  1 Dec 2019 06:21:29 +0000 (UTC)
From: edgar@pettijohn-web.com
Reply-To: edgar@pettijohn-web.com
To: gnats-bugs@NetBSD.org
Subject: cksum(1) doesn't inform you of passed checks
X-Send-Pr-Version: www-1.0

>Number:         54726
>Category:       bin
>Synopsis:       cksum(1) doesn't inform you of passed checks
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sun Dec 01 06:25:00 +0000 2019
>Last-Modified:  Mon Dec 02 11:10:01 +0000 2019
>Originator:     Edgar Pettijohn III
>Release:        8.1
>Organization:
>Environment:
NetBSD localhost 8.1 NetBSD 8.1 (GENERIC) #0: Fri May 31 08:43:59 UTC 2019  mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/amd64/compile/GENERIC amd64

>Description:
When using cksum(1) to test source tarballs I noticed there was no output.

localhost$ cat MD5 | /usr/bin/cksum -c
localhost$ 

This struck me as odd. So after reading the manual it would appear the only way to know that the files were ok is to:
localhost$ echo $?
0

Which doesn't seem very user friendly.
>How-To-Repeat:
Use cksum(1) to verify files.
>Fix:
Index: cksum.c
===================================================================
RCS file: /cvsroot/src/usr.bin/cksum/cksum.c,v
retrieving revision 1.48
diff -r1.48 cksum.c
355d354
<                                       
366d364
< 
456a455,458
>                       } else {
>                               if (hash)
>                                       printf("(%s) ", hash->hashname);
>                               printf("%s: PASSED\n", filename);
459d460
< 

localhost$ cat MD5 | ~/bin/cksum -c
(MD5) gnusrc.tgz: PASSED
(MD5) sharesrc.tgz: PASSED
(MD5) src.tgz: PASSED
(MD5) syssrc.tgz: PASSED
(MD5) xsrc.tgz: PASSED

Much nicer :)

>Audit-Trail:
From: mlelstv@serpens.de (Michael van Elst)
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: bin/54726: cksum(1) doesn't inform you of passed checks
Date: Sun, 1 Dec 2019 11:53:18 -0000 (UTC)

 edgar@pettijohn-web.com writes:

 >localhost$ cat MD5 | /usr/bin/cksum -c
 >localhost$ 

 >This struck me as odd. So after reading the manual it would appear the only way to know that the files were ok is to:
 >localhost$ echo $?
 >0


 That is how all UNIX tools traditionally behave. The commands are used in
 scripts and the check result is used to control the proram flow. E.g. compare
 to 'gzip -t' where you can add the '-v' verbose flag to get human readable
 text.

 -- 
 -- 
                                 Michael van Elst
 Internet: mlelstv@serpens.de
                                 "A potential Snark may lurk in every tree."

From: Edgar Pettijohn <edgar@pettijohn-web.com>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: bin/54726: cksum(1) doesn't inform you of passed checks
Date: Sun, 1 Dec 2019 09:23:07 -0600

 On 2019-12-01 05:55, Michael van Elst wrote:
 > The following reply was made to PR bin/54726; it has been noted by GNATS.
 >
 > From: mlelstv@serpens.de (Michael van Elst)
 > To: gnats-bugs@netbsd.org
 > Cc:
 > Subject: Re: bin/54726: cksum(1) doesn't inform you of passed checks
 > Date: Sun, 1 Dec 2019 11:53:18 -0000 (UTC)
 >
 >   edgar@pettijohn-web.com writes:
 >   
 >   >localhost$ cat MD5 | /usr/bin/cksum -c
 >   >localhost$
 >   
 >   >This struck me as odd. So after reading the manual it would appear the only way to know that the files were ok is to:
 >   >localhost$ echo $?
 >   >0
 >   
 >   
 >   That is how all UNIX tools traditionally behave. The commands are used in
 >   scripts and the check result is used to control the proram flow. E.g. compare
 >   to 'gzip -t' where you can add the '-v' verbose flag to get human readable
 >   text.
 >   
 >   --
 >   --
 >                                   Michael van Elst
 >   Internet: mlelstv@serpens.de
 >                                   "A potential Snark may lurk in every tree."
 >   

 Then why does it give you human readable text for failed files? Seems 
 like it should either do both or neither. If neither add a -v flag to 
 get both.

 Edgar

From: mlelstv@serpens.de (Michael van Elst)
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: bin/54726: cksum(1) doesn't inform you of passed checks
Date: Sun, 1 Dec 2019 21:27:13 -0000 (UTC)

 edgar@pettijohn-web.com (Edgar Pettijohn) writes:

 > Then why does it give you human readable text for failed files? Seems 
 > like it should either do both or neither. If neither add a -v flag to 
 > get both.

 Apparently failures were considered important and the regular
 successes shouldn't clutter the script output. Most original
 UNIX commands work this way. GNU commands tend to be a bit more
 verbose.

 The original tool didn't have the check mode and it still lacks
 such a mode on Linux or other UNIX systems. It was added since the
 Linux md5sum command had something similar.

 But md5sum behaves differently, there you normally get OK / FAILED on
 stdout for each file and an additional summary message on stderr
 for failures. You can add a --quiet option to hide the OK output
 but keep the FAILED output.

 -- 
 -- 
                                 Michael van Elst
 Internet: mlelstv@serpens.de
                                 "A potential Snark may lurk in every tree."

From: Robert Elz <kre@munnari.OZ.AU>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: bin/54726: cksum(1) doesn't inform you of passed checks
Date: Mon, 02 Dec 2019 07:58:03 +0700

     Date:        Sun,  1 Dec 2019 15:25:01 +0000 (UTC)
     From:        Edgar Pettijohn <edgar@pettijohn-web.com>
     Message-ID:  <20191201152501.8B4EB7A1AD@mollari.NetBSD.org>

   |  Then why does it give you human readable text for failed files? Seems 
   |  like it should either do both or neither. If neither add a -v flag to 
   |  get both.

 It is the philosophy, when all is OK, shut up, when something is wrong,
 say what.   Other tools, like diff, cmp, cc, ... work just the same way.

 When everything as it should be, you aren't bothered by meaningless noise.
 When something is not, you get told - which then stands out - it is obvious
 that the message is something to look at.

 kre

From: Edgar Pettijohn <edgar@pettijohn-web.com>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: bin/54726: cksum(1) doesn't inform you of passed checks
Date: Sun, 1 Dec 2019 19:09:48 -0600

 On 2019-12-01 19:00, Robert Elz wrote:
 > The following reply was made to PR bin/54726; it has been noted by GNATS.
 >
 > From: Robert Elz <kre@munnari.OZ.AU>
 > To: gnats-bugs@netbsd.org
 > Cc:
 > Subject: Re: bin/54726: cksum(1) doesn't inform you of passed checks
 > Date: Mon, 02 Dec 2019 07:58:03 +0700
 >
 >       Date:        Sun,  1 Dec 2019 15:25:01 +0000 (UTC)
 >       From:        Edgar Pettijohn <edgar@pettijohn-web.com>
 >       Message-ID:  <20191201152501.8B4EB7A1AD@mollari.NetBSD.org>
 >   
 >     |  Then why does it give you human readable text for failed files? Seems
 >     |  like it should either do both or neither. If neither add a -v flag to
 >     |  get both.
 >   
 >   It is the philosophy, when all is OK, shut up, when something is wrong,
 >   say what.   Other tools, like diff, cmp, cc, ... work just the same way.
 >   
 >   When everything as it should be, you aren't bothered by meaningless noise.
 >   When something is not, you get told - which then stands out - it is obvious
 >   that the message is something to look at.
 >   
 >   kre
 >   

 Consider this usecase.

 localhost$ cat SHA256 | /usr/bin/cksum -c
 (SHA256) libressl-1.0.0.tar.gz: FAILED
 (SHA256) libressl-2.0.0.tar.gz: FAILED
 (SHA256) libressl-2.0.1.tar.gz: FAILED
 (SHA256) libressl-2.0.2.tar.gz: FAILED
 (SHA256) libressl-2.0.3.tar.gz: FAILED
 (SHA256) libressl-2.0.4.tar.gz: FAILED
 (SHA256) libressl-2.0.5.tar.gz: FAILED
 (SHA256) libressl-2.0.6.tar.gz: FAILED
 (SHA256) libressl-2.1.0.tar.gz: FAILED
 (SHA256) libressl-2.1.1.tar.gz: FAILED
 (SHA256) libressl-2.1.10-relnotes.txt: FAILED
 (SHA256) libressl-2.1.10.tar.gz: FAILED
 (SHA256) libressl-2.1.2.tar.gz: FAILED
 (SHA256) libressl-2.1.3.tar.gz: FAILED
 (SHA256) libressl-2.1.4-relnotes.txt: FAILED
 (SHA256) libressl-2.1.4-windows.zip: FAILED
 (SHA256) libressl-2.1.4.tar.gz: FAILED
 (SHA256) libressl-2.1.5-relnotes.txt: FAILED
 (SHA256) libressl-2.1.5-windows.zip: FAILED
 (SHA256) libressl-2.1.5.tar.gz: FAILED
 (SHA256) libressl-2.1.6-relnotes.txt: FAILED
 (SHA256) libressl-2.1.6-windows.zip: FAILED
 (SHA256) libressl-2.1.6.tar.gz: FAILED
 (SHA256) libressl-2.1.7.tar.gz: FAILED
 (SHA256) libressl-2.1.8.tar.gz: FAILED
 (SHA256) libressl-2.1.9.tar.gz: FAILED
 (SHA256) libressl-2.2.0-relnotes.txt: FAILED
 (SHA256) libressl-2.2.0.tar.gz: FAILED
 (SHA256) libressl-2.2.1-relnotes.txt: FAILED
 (SHA256) libressl-2.2.1-windows.zip: FAILED
 (SHA256) libressl-2.2.1.tar.gz: FAILED
 (SHA256) libressl-2.2.2-relnotes.txt: FAILED
 (SHA256) libressl-2.2.2-windows.zip: FAILED
 (SHA256) libressl-2.2.2.tar.gz: FAILED
 (SHA256) libressl-2.2.3-relnotes.txt: FAILED
 (SHA256) libressl-2.2.3-windows.zip: FAILED
 (SHA256) libressl-2.2.3.tar.gz: FAILED
 (SHA256) libressl-2.2.4-windows.zip: FAILED
 (SHA256) libressl-2.2.4.tar.gz: FAILED
 (SHA256) libressl-2.2.5-relnotes.txt: FAILED
 (SHA256) libressl-2.2.5-windows.zip: FAILED
 (SHA256) libressl-2.2.5.tar.gz: FAILED
 (SHA256) libressl-2.2.6-relnotes.txt: FAILED
 (SHA256) libressl-2.2.6.tar.gz: FAILED
 (SHA256) libressl-2.2.7-relnotes.txt: FAILED
 (SHA256) libressl-2.2.7-windows.zip: FAILED
 (SHA256) libressl-2.2.7.tar.gz: FAILED
 (SHA256) libressl-2.2.8-windows.zip: FAILED
 (SHA256) libressl-2.2.8.tar.gz: FAILED
 (SHA256) libressl-2.2.9-windows.zip: FAILED
 (SHA256) libressl-2.2.9.tar.gz: FAILED
 (SHA256) libressl-2.3.0-relnotes.txt: FAILED
 (SHA256) libressl-2.3.0-windows.zip: FAILED
 (SHA256) libressl-2.3.0.tar.gz: FAILED
 (SHA256) libressl-2.3.1-relnotes.txt: FAILED
 (SHA256) libressl-2.3.1-windows.zip: FAILED
 (SHA256) libressl-2.3.1.tar.gz: FAILED
 (SHA256) libressl-2.3.10-relnotes.txt: FAILED
 (SHA256) libressl-2.3.10-windows.zip: FAILED
 (SHA256) libressl-2.3.10.tar.gz: FAILED
 (SHA256) libressl-2.3.2-relnotes.txt: FAILED
 (SHA256) libressl-2.3.2-windows.zip: FAILED
 (SHA256) libressl-2.3.2.tar.gz: FAILED
 (SHA256) libressl-2.3.3-relnotes.txt: FAILED
 (SHA256) libressl-2.3.3-windows.zip: FAILED
 (SHA256) libressl-2.3.3.tar.gz: FAILED
 (SHA256) libressl-2.3.4-relnotes.txt: FAILED
 (SHA256) libressl-2.3.4-windows.zip: FAILED
 (SHA256) libressl-2.3.4.tar.gz: FAILED
 (SHA256) libressl-2.3.5-relnotes.txt: FAILED
 (SHA256) libressl-2.3.5-windows.zip: FAILED
 (SHA256) libressl-2.3.5.tar.gz: FAILED
 (SHA256) libressl-2.3.6-relnotes.txt: FAILED
 (SHA256) libressl-2.3.6-windows.zip: FAILED
 (SHA256) libressl-2.3.6.tar.gz: FAILED
 (SHA256) libressl-2.3.7-relnotes.txt: FAILED
 (SHA256) libressl-2.3.7-windows.zip: FAILED
 (SHA256) libressl-2.3.7.tar.gz: FAILED
 (SHA256) libressl-2.3.8-relnotes.txt: FAILED
 (SHA256) libressl-2.3.8-windows.zip: FAILED
 (SHA256) libressl-2.3.8.tar.gz: FAILED
 (SHA256) libressl-2.3.9-relnotes.txt: FAILED
 (SHA256) libressl-2.3.9-windows.zip: FAILED
 (SHA256) libressl-2.3.9.tar.gz: FAILED
 (SHA256) libressl-2.4.0-relnotes.txt: FAILED
 (SHA256) libressl-2.4.0-windows.zip: FAILED
 (SHA256) libressl-2.4.0.tar.gz: FAILED
 (SHA256) libressl-2.4.1-relnotes.txt: FAILED
 (SHA256) libressl-2.4.1-windows.zip: FAILED
 (SHA256) libressl-2.4.1.tar.gz: FAILED
 (SHA256) libressl-2.4.2-relnotes.txt: FAILED
 (SHA256) libressl-2.4.2-windows.zip: FAILED
 (SHA256) libressl-2.4.2.tar.gz: FAILED
 (SHA256) libressl-2.4.3-relnotes.txt: FAILED
 (SHA256) libressl-2.4.3-windows.zip: FAILED
 (SHA256) libressl-2.4.3.tar.gz: FAILED
 (SHA256) libressl-2.4.4-relnotes.txt: FAILED
 (SHA256) libressl-2.4.4-windows.zip: FAILED
 (SHA256) libressl-2.4.4.tar.gz: FAILED
 (SHA256) libressl-2.4.5-relnotes.txt: FAILED
 (SHA256) libressl-2.4.5-windows.zip: FAILED
 (SHA256) libressl-2.4.5.tar.gz: FAILED
 (SHA256) libressl-2.5.0-relnotes.txt: FAILED
 (SHA256) libressl-2.5.0-windows.zip: FAILED
 (SHA256) libressl-2.5.0.tar.gz: FAILED
 (SHA256) libressl-2.5.1-relnotes.txt: FAILED
 (SHA256) libressl-2.5.1-windows.zip: FAILED
 (SHA256) libressl-2.5.1.tar.gz: FAILED
 (SHA256) libressl-2.5.2-relnotes.txt: FAILED
 (SHA256) libressl-2.5.2-windows.zip: FAILED
 (SHA256) libressl-2.5.2.tar.gz: FAILED
 (SHA256) libressl-2.5.3-relnotes.txt: FAILED
 (SHA256) libressl-2.5.3-windows.zip: FAILED
 (SHA256) libressl-2.5.3.tar.gz: FAILED
 (SHA256) libressl-2.5.4-relnotes.txt: FAILED
 (SHA256) libressl-2.5.4-windows.zip: FAILED
 (SHA256) libressl-2.5.4.tar.gz: FAILED
 (SHA256) libressl-2.5.5-relnotes.txt: FAILED
 (SHA256) libressl-2.5.5-windows.zip: FAILED
 (SHA256) libressl-2.5.5.tar.gz: FAILED
 (SHA256) libressl-2.6.0-relnotes.txt: FAILED
 (SHA256) libressl-2.6.0.tar.gz: FAILED
 (SHA256) libressl-2.6.1-relnotes.txt: FAILED
 (SHA256) libressl-2.6.1.tar.gz: FAILED
 (SHA256) libressl-2.6.2-relnotes.txt: FAILED
 (SHA256) libressl-2.6.2.tar.gz: FAILED
 (SHA256) libressl-2.6.3-relnotes.txt: FAILED
 (SHA256) libressl-2.6.3.tar.gz: FAILED
 (SHA256) libressl-2.6.4-relnotes.txt: FAILED
 (SHA256) libressl-2.6.4.tar.gz: FAILED
 (SHA256) libressl-2.6.5-relnotes.txt: FAILED
 (SHA256) libressl-2.6.5.tar.gz: FAILED
 (SHA256) libressl-2.7.0-relnotes.txt: FAILED
 (SHA256) libressl-2.7.0.tar.gz: FAILED
 (SHA256) libressl-2.7.1-relnotes.txt: FAILED
 (SHA256) libressl-2.7.1.tar.gz: FAILED
 (SHA256) libressl-2.7.2-relnotes.txt: FAILED
 (SHA256) libressl-2.7.2.tar.gz: FAILED
 (SHA256) libressl-2.7.3-relnotes.txt: FAILED
 (SHA256) libressl-2.7.3.tar.gz: FAILED
 (SHA256) libressl-2.7.4-relnotes.txt: FAILED
 (SHA256) libressl-2.7.4.tar.gz: FAILED
 (SHA256) libressl-2.7.5-relnotes.txt: FAILED
 (SHA256) libressl-2.7.5.tar.gz: FAILED
 (SHA256) libressl-2.8.0-relnotes.txt: FAILED
 (SHA256) libressl-2.8.0.tar.gz: FAILED
 (SHA256) libressl-2.8.1-relnotes.txt: FAILED
 (SHA256) libressl-2.8.1.tar.gz: FAILED
 (SHA256) libressl-2.8.2-relnotes.txt: FAILED
 (SHA256) libressl-2.8.2.tar.gz: FAILED
 (SHA256) libressl-2.8.3-relnotes.txt: FAILED
 (SHA256) libressl-2.8.3.tar.gz: FAILED
 (SHA256) libressl-2.9.0-relnotes.txt: FAILED
 (SHA256) libressl-2.9.0.tar.gz: FAILED
 (SHA256) libressl-2.9.1-relnotes.txt: FAILED
 (SHA256) libressl-2.9.1.tar.gz: FAILED
 (SHA256) libressl-2.9.2-relnotes.txt: FAILED
 (SHA256) libressl-2.9.2.tar.gz: FAILED
 (SHA256) libressl-3.0.0-relnotes.txt: FAILED
 (SHA256) libressl-3.0.0.tar.gz: FAILED
 (SHA256) libressl-3.0.1-relnotes.txt: FAILED
 (SHA256) libressl-3.0.1.tar.gz: FAILED
 (SHA256) libressl.asc: FAILED
 (SHA256) libressl.pub: FAILED

 Where you have to search a long list of failures looking for the absence 
 of your file to know that its ok.

 vs

 (SHA256) libressl-2.9.0.tar.gz: FAILED
 (SHA256) libressl-2.9.1-relnotes.txt: FAILED
 (SHA256) libressl-2.9.1.tar.gz: FAILED
 (SHA256) libressl-2.9.2-relnotes.txt: FAILED
 (SHA256) libressl-2.9.2.tar.gz: FAILED
 (SHA256) libressl-3.0.0-relnotes.txt: FAILED
 (SHA256) libressl-3.0.0.tar.gz: FAILED
 (SHA256) libressl-3.0.1-relnotes.txt: FAILED
 (SHA256) libressl-3.0.1.tar.gz: FAILED
 (SHA256) libressl-3.0.2-relnotes.txt: PASSED
 (SHA256) libressl-3.0.2.tar.gz: PASSED
 (SHA256) libressl.asc: FAILED
 (SHA256) libressl.pub: FAILED

 Perhaps adding a -C switch for MISSING/OK/FAILED messages and -c stays 
 the same? I don't think someone should have to write a script for 
 testing file integrity.

 Edgar

From: Robert Elz <kre@munnari.OZ.AU>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: bin/54726: cksum(1) doesn't inform you of passed checks
Date: Mon, 02 Dec 2019 18:07:45 +0700

     Date:        Mon,  2 Dec 2019 01:10:03 +0000 (UTC)
     From:        Edgar Pettijohn <edgar@pettijohn-web.com>
     Message-ID:  <20191202011003.60F607A1D6@mollari.NetBSD.org>

   |  Consider this usecase.

 You mean

 	grep 'libressl-3\.0\.2' SHA256 | /usr/bin/cksum -c

 if all you're looking for is that one version.   Use the tools
 properly and you won't have problems.   Eye-balling long lists
 in the hope that you correctly identify what you're looking for
 is never going to be the best method.

 kre

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.45 2018/12/21 14:23:33 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.