GNU bug report logs - #31493
please add null-terminated line output for sha256sum, sha1sum, etc

Previous Next

Package: coreutils;

Reported by: Daniel Kahn Gillmor <dkg <at> fifthhorseman.net>

Date: Fri, 18 May 2018 14:50:01 UTC

Severity: normal

Tags: fixed

Done: Assaf Gordon <assafgordon <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Daniel Kahn Gillmor <dkg <at> fifthhorseman.net>
To: 31493 <at> debbugs.gnu.org
Subject: bug#31493: please add null-terminated line output for sha256sum, sha1sum, etc
Date: Fri, 18 May 2018 10:49:28 -0400
[Message part 1 (text/plain, inline)]
Hi GNU coreutils developers!

This is a feature request for the hashing/digesting tools in coreutils,
like sha256sum, sha1sum, md5sum, etc.

currently, those tools emit line-oriented output about the files that
they hash.  if a file has a newline in the name, those tools emit output
with a leading /, like so:

0 dkg <at> alice:~$ sha256sum a*
348df4eb47f9230bfe89637afe7409bec883424d822257b6cbbce93ee780d992  a
98ea6e4f216f2fb4b69fff9b3a44842c38686ca685f3f55dc48c5d3fb1107be4  a	b
\98ea6e4f216f2fb4b69fff9b3a44842c38686ca685f3f55dc48c5d3fb1107be4  a\nb\n
0 dkg <at> alice:~$ 

most users of sha256sum (etc) in shell scripts probably are unaware of
this behavior and just cross their fingers and hope no file has a
newline in its filename.

However, other common tools have processing options that use
NUL-terminated records. For example, sort (-z) and find (-print0) and
xargs (-0)

It would be nice if sha256sum (etc) had a comparable functionality to be
able to fit better into pipelines with these other tools.

So i'm proposing a flag -z, --zero-terminated for these tools that
alters the output (and input) format, to use NUL chars instead of
newlines.  presumably when that flag is used, the emitted data should
*not* be backslash-escaped.

      --dkg
[signature.asc (application/pgp-signature, inline)]

This bug report was last modified 6 years and 209 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.