Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Jun 2020 04:42:21 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 247295] sha256 -c with stdin always exits 0
Message-ID:  <bug-247295-227@https.bugs.freebsd.org/bugzilla/>

index | next in thread | raw e-mail

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=247295

            Bug ID: 247295
           Summary: sha256 -c with stdin always exits 0
           Product: Base System
           Version: 12.1-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: sega01@go-beyond.org

sha256 (and its cousins) have a -c argument to validate against a given
checksum. This works fine on files. Example:

$ echo test > file
$ sha256 file
SHA256 (file) =
f2ca1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26fd2
$ sha256 -c f2ca1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26fd2
file; echo $?
SHA256 (file) =
f2ca1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26fd2
0
$ sha256 -c dead1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26beef
file; echo $?
SHA256 (file) =
f2ca1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26fd2 [ Failed ]
2

However, stdin appears to either be always positive or false positive:

$ cat file | sha256
f2ca1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26fd2
$ cat file | sha256 -c
f2ca1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26fd2; echo $?
0
$ cat file | sha256 -c
dead1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc2beef; echo $?
0

I think that sha256 -c should give an error or warning with stdin since it is
not handled properly, or preferably function as expected. It would be easy to
be misled by the current behavior.

Please let me know if you need anything else from me. Thank you!

-- 
You are receiving this mail because:
You are the assignee for the bug.

home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-247295-227>