[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Feature Request shaXXXsum pipeout
From: |
Pádraig Brady |
Subject: |
Re: Feature Request shaXXXsum pipeout |
Date: |
Wed, 16 Dec 2020 19:59:26 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:84.0) Gecko/20100101 Thunderbird/84.0 |
On 16/12/2020 16:06, Stefan Althöfer wrote:
Hi all,
I'd like to request a new --pipeout feature for shaXXXsum to allow on-the-fly
checking of files. It should be possible to request shaXXXsum to pass stdin
data to stdout.
I'd like to do s.th. like this to avoid reading files twice from network or
storing them locally:
$ set -o pipefail
$ cat network_path/big.img.gz | sha256sum --pipeout -c cs.sha256 | gzip
-d | dd of=/dev/sdx
--pipeout should imply --quiet of course and just return nonzero on fails.
It did a test implmentation for sha256 case. Seems this can be implemented
easily. Maybe my implementation is not bullet proof however.
Questions to the maintainers:
. Is such a feature desirable/acceptable?
. If so, can --pipeout be used or should there be a better option name?
. Should there be a single letter option?
A similar suggestion was discussed
at:https://lists.gnu.org/archive/html/coreutils/2019-05/msg00025.html
That was slightly different as it proposed consuming
all the data before outputting anything.
If one was OK in consuming the data in parallel
you might use tee to do the check? Something like:
... | tee >(sha256sum -c cs.sha256 || touch cs.fail) | ...
test -f cs.fail && { rm cs.fail; exit 1; }
cheers,
Pádraig