md5sum <FILE produces spurious ` -' in output
Thanks to everyone for your contributions, and to the voting committee
members for your votes. The Technical Committee has passed the
following resolution:
1. The Technical Committe has considered the questions raised in
Bug#164591 and Bug#164889, concerning the output format from
md5sum when the input is stdin.
2. For the reasons discussed below we agree with the submitters of
the bugs, that md5sum without arguments should print only the
checksum.
3. We will refer to the alternative output formats as follows:
* The `bare' format: the checksum (in hex) followed by a single
newline.
* The `annotated' format: the checksum (in hex) followed by two
spaces, a hyphen, and a newline.
4. This decision discusses and covers only the case where md5sum
calculates and prints a single checksum, of data fed to it on
standard input. Other uses of md5sum are not discussed, except to
note that we do not see any need to suggest any changes to those
behaviours.
5. The bare format is usually more convenient. It would therefore be
good for there to be a simple way to produce it.
6. Regarding the compatibility risks of changing the behaviour, we
note that:
i. The behaviour of Debian's md5sum has varied, changing several
times between the bare and the annotated format.
ii. Different implementations of md5sum have different output
formats, so that the most widespread behaviour has not been
consistent either.
iii. It seems unlikely to us that there are significant numbers of
programs which depend on the annotated format.
7. Although we do not believe the annotated format is useful except
for compatibility reasons, it is acceptable for there to be a way
to generate the annotated format.
8. Other GNU utilities for reporting on the contents of files are not
very consistent regarding when they print input filenames, but few
utilities print the `-' when the program reads from stdin and `-'
was not supplied as a command line argument.
9. At least two versions of md5sum have been used in Debian - the one
currently in the dpkg package which originated with Colin Plumb,
and the GNU version. Likewise, there is some discussion as to
whether md5sum should continue to be supplied by dpkg or by the
Debian coreutils package. We do not address the issue of which
version of md5sum should be used, or which package it should
reside in. Our conclusions apply to the utility md5sum no matter
which version is chosen and no matter which package it is in.
10. Accordingly we request (or require, if the required supermajority
is reached according to the Constitution) that the maintainer(s)
of the package(s) containing md5sum cooperate to change the
behaviour, as shown in the following examples:
i. Output format when no argument supplied:
$ md5sum </dev/null | cat -vet
d41d8cd98f00b204e9800998ecf8427e$
$
ii. Output when single `-' argument supplied: either
$ md5sum - </dev/null | cat -vet
d41d8cd98f00b204e9800998ecf8427e -$
$
or
$ md5sum - </dev/null | cat -vet
d41d8cd98f00b204e9800998ecf8427e$
$
We recommend, but do not insist on, the former.
iii. For other combinations of arguments we do not request
any change in behaviour.
11. We request (or require) that the package maintainer indicate
whether they would prefer the bug submitter to prepare a patch.
If so then when the submitter has prepared a reasonable patch, the
maintainer should accept and apply it if they approve; otherwise,
or if they prefer, they should do the necessary work themselves.
12. We recommend that, if applicable, the resulting patch be sent
upstream for inclusion in the GNU coreutils. If Debian continues
to use the non-GNU version, we recommend that the bug submitter
prepare a patch to GNU coreutils and submit it to the GNU
project.
13. We note that the issues surrounding sha1sum are similar to those
surrounding md5sum. We have not been asked to rule on sha1sum but
expect that if the question arose our decision would be the same.
Votes in favour: Ian, Raul, Manoj, Guy
No other votes.
We have achieved the (AFAICT) 4:1 majority required to overrule the
maintainer. I'll retag and reassign the bug to dpkg, and update the
committee web page.
Ian.
Reply to: