GNU sha256sum(1) &tc --check (-c) output depends on order of --quiet and --warn

Bug #1902311 reported by Brian Foster
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
coreutils (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

The output of GNU sha256sum --check (or -c), and related tools (i.e., sha1sum,
sha224sum, sha384sum, and sha512sum) depends on the order of the --quiet and
--warn options. This is counter-intuitive, not documented in the man(1) pages,
and unnecessary.

Simple example:

  1$ date >/tmp/data
  2$ sha256sum /tmp/data >/tmp/sums
  3$ sha256sum -c --warn --quiet /tmp/sums # No output (expected)
  4$ sha256sum -c --quiet --warn /tmp/sums # Unexpected "Ok"...
  /tmp/data: OK
  5$

The manual page says (spurious lines omitted):

   The following five options are useful only when verifying checksums:
     --quiet don't print OK for each successfully verified file
     -w, --warn warn about improperly formatted checksum lines

There is no reason --warn should affect the operation of --quiet (nor
visa-versa). The operations as documented are orthogonal.

Attached is a bash(1) shell script written when puzzling over this
inconsistent behaviour; it may be useful (use --help for a summary).

ProblemType: Bug
DistroRelease: Ubuntu 20.04
Package: coreutils 8.30-3ubuntu2
ProcVersionSignature: Ubuntu 5.4.0-52.57-generic 5.4.65
Uname: Linux 5.4.0-52-generic x86_64
ApportVersion: 2.20.11-0ubuntu27.10
Architecture: amd64
CasperMD5CheckResult: skip
CurrentDesktop: KDE
Date: Fri Oct 30 21:34:31 2020
InstallationDate: Installed on 2020-10-19 (11 days ago)
InstallationMedia: Kubuntu 20.04 LTS "Focal Fossa" - Release amd64 (20200423)
SourcePackage: coreutils
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Brian Foster (blfoster) wrote :
Revision history for this message
Brian Foster (blfoster) wrote :

Obviously, I meant sha256sum(1) in the bug's title! (*sighs*)

Revision history for this message
Hans Joachim Desserud (hjd) wrote :

Thanks for taking your time to report this issue and help making Ubuntu better.

I tried the simple example given in the description and got the same, somewhat unexpected result with coreutils 8.32-3ubuntu1 on Ubuntu 20.10. Thus marking confirmed.

By the way, if you click the yellow pencil next to the title, you can update it :)

Changed in coreutils (Ubuntu):
status: New → Confirmed
tags: added: groovy
Brian Foster (blfoster)
summary: - GNU sha256(1) &tc --check (-c) output depends on order of --quiet and
+ GNU sha256sum(1) &tc --check (-c) output depends on order of --quiet and
--warn
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.