GNU bug report logs -
#15644
Possible bug in md5sum, sha1 and sha2 checksum utilities
Previous Next
Reported by: jock97 <at> ntlworld.com
Date: Fri, 18 Oct 2013 16:01:01 UTC
Severity: normal
Tags: notabug
Done: Eric Blake <eblake <at> redhat.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Your bug report
#15644: Possible bug in md5sum, sha1 and sha2 checksum utilities
which was filed against the coreutils package, has been closed.
The explanation is attached below, along with your original report.
If you require more details, please reply to 15644 <at> debbugs.gnu.org.
--
15644: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=15644
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
[Message part 3 (text/plain, inline)]
tag 15644 notabug
thanks
On 10/18/2013 07:48 AM, jock97 <at> ntlworld.com wrote:
> Hi,
> First, I hope this isn't some strange manifestation of shell
> backslash escaping that has fooled me. I've fiddled around trying to
> eliminate that possibility, but it could still happen. Apologies if it is...
No, what you are seeing is intentional. It also occurs for literal
newlines in files. Basically, since *sum output is line oriented, we
have to have a way to escape newlines in file names; and in order to
escape newlines, we also have to have a way to escape our escape.
Hence, we have documented that our output format starts with a backslash
on any line where the filename requires unescaping.
> # Checksum it.
>>>> sha1sum 'jun\k'
> \da39a3ee5e6b4b0d3255bfef95601890afd80709 jun\\k
>
> # Checksum it via stdin.
>>>> sha1sum <'jun\k'
> da39a3ee5e6b4b0d3255bfef95601890afd80709 -
>
> In case the backslashes don't make it through the email system, the file
> has a single backslash in its name. The first checksum starts with a
> backslash. The second doesn't. I think both outputs should be the same.
The difference on checking the named file vs. checking from stdin is
that from stdin, nothing needs escaping. The difference is intentional,
and there's nothing to fix, at least not related to your question.
[There IS the related matter that we SHOULD be escaping carriage returns
as well, because of sum files that get transmitted with DOS-style line
endings; the fact that we have unambiguous output for newline, but not
for trailing carriage return (was it part of the file name or just the
transmitter sending it in DOS format?) is awkward]
I'm closing this as not a bug, but feel free to add further comments to
the thread as needed.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[signature.asc (application/pgp-signature, attachment)]
[Message part 5 (message/rfc822, inline)]
Hi,
First, I hope this isn't some strange manifestation of shell
backslash escaping that has fooled me. I've fiddled around trying to
eliminate that possibility, but it could still happen. Apologies if it is...
Anyway, what I think might be a bug is as follows:
If you use any of md5sum, sha1sum, sha224sum, sha256sum, sha384sum or
sha512sum (are there any others?) on a file whose name contains a
backslash, then the output is prefixed with what appears to be an
erroneous backslash.
I'm using version 7.1 of these GNU coreutils commands. The problem was
also present in version 6.9.
To demonstrate the problem, do the following at a shell prompt >>> :
# Create empty file with backslash in its name.
>>> touch 'jun\k'
# Checksum it.
>>> sha1sum 'jun\k'
\da39a3ee5e6b4b0d3255bfef95601890afd80709 jun\\k
# Checksum it via stdin.
>>> sha1sum <'jun\k'
da39a3ee5e6b4b0d3255bfef95601890afd80709 -
In case the backslashes don't make it through the email system, the file
has a single backslash in its name. The first checksum starts with a
backslash. The second doesn't. I think both outputs should be the same.
Redirecting the output to a file makes no difference, so I don't think
it's a terminal issue.
Regards,
Rodney Warren-Smith
This bug report was last modified 11 years and 302 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.