Subject: Re: bug#9956: Linux program "sum"

From: Jim Meyering <[email-masked]>
Date: Sun, 06 Nov 2011 09:38:05 +0100

Eric Blake wrote:
> On 11/04/2011 12:37 PM, Rodney Rieck wrote:
>>     If you type in something like this:  sum -r *
>>
>>     and if there are multiple files present in the current directory, you
>>     will get output like this for each file it checks:
>>
>>     [check_sum] [number_of_blocks] [file_name]
>>
>>     If though on the command line you change the "*" to a single file name,
>>     the output is the same except that it doesn't print/display the
>>     "[file_name]", I guess because that seems redundant because the file
>>     name is already known and was typed in on the command line.
>
> Thanks for the report.  If you want 'sum' to output the file name,
> even for one file, then use 'sum --sysv' (or sum -s), although that
> alters the output to strip leading zeroes and use slightly different
> spacing:
>
> $ sum a
> 00000     0 a
> $ sum -s a
> 0 0 a
>
> Since this feature is already implemented, I'm closing out this bug report.

Note that if you really do want sum's default checksum algorithm, then
you do not want to add the --sysv option, since that usually results
in a different checksum:

    $ echo foo > k
    $ sum k; sum -s k
    00106     1
    334 1 k

Depending on your application, if you're not particularly attached
to sum's checksum algorithm, then you may want to use sha1sum instead.