GNU bug report logs -
#26002
[patch] md5sum --digest-only
Previous Next
Reported by: Michael Vogt <mvo <at> ubuntu.com>
Date: Mon, 6 Mar 2017 16:20:02 UTC
Severity: wishlist
Tags: patch, wontfix
Done: Assaf Gordon <assafgordon <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
Message #8 received at 26002 <at> debbugs.gnu.org (full text, mbox):
On 05/03/17 23:55, Michael Vogt wrote:
> Hi,
>
> this is a bit of a RFC (anlong with a patch). I would like to have an
> option in md5sum (and friends) that displays only the digest without
> the filename. The use-case is mostly package maintainer scripts. They
> often need the md5sum to e.g. check if a conffile has changed and use
> patterns like:
>
> `md5sum /etc/papersize 2> /dev/null | awk '{print $1}'`
> `md5sum /etc/lsb-release | cut -d" " -f1`
> $(md5sum /etc/networks | sed -e 's/ .*//')
>
> Having a --digest-only option in md5sum would make this a bit more
> uniform.
>
> Attached is a small patch, if the suggestion gets accepted I'm happy
> to flesh it out more and write the man-page entry and tests.
This is one of those marginal ones, previously discussed as indicated at:
https://www.gnu.org/software/coreutils/rejected_requests.html#checksum
Note your forms above don't handle the case where a leading '\'
is added for certain edge case filenames.
The most general solution would be something like:
md5sum < the_file | cut -f1 -d' '
I suppose you could avoid the new option and behave like wc.
I.E. don't print the extraneous '-' at all.
That would also be backwards compat with all the processing forms above.
Though not forwards compat, in that new scripts running against
older versions of md5sum would now not work.
Given the minimal/obvious processing involved,
I'm still slightly in favor for leaving as is.
thanks,
Pádraig
This bug report was last modified 6 years and 268 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.