Subject: Re: [GUILT] [PATCH] Fix fatal "guilt graph" error in sha1sum invocation.

From: Per Cederqvist <[email-masked]>
Date: Thu, 15 Mar 2012 09:42:11 +0100

On 03/14/2012 03:27 PM, Andreas Schwab wrote:

> Per Cederqvist<[email-masked]>  writes:
>
>> -	openssl dgst -sha1 "$1" | sed "s,SHA1.\(.*\).= \(.*\),\2  \1,"
>> +	if [ $# = 1 ]
>> +	then
>> +		openssl dgst -sha1 "$1" | sed "s,SHA1.\(.*\).= \(.*\),\2  \1,"
>> +	else
>> +		openssl dgst -sha1 | sed 's,$,  -,'
>
> $ openssl dgst -sha1</dev/null
> (stdin)= da39a3ee5e6b4b0d3255bfef95601890afd80709

Was that on a Darwin? If so, my fix obviously needs some
work on that platform. I tested openssl-0.9.8o on Ubuntu
11.04, and here it looks like this:

$ openssl dgst -sha1</dev/null
da39a3ee5e6b4b0d3255bfef95601890afd80709
$ openssl version
OpenSSL 0.9.8o 01 Jun 2010

     /ceder

>>   # usage: sha1 [file]
>>   sha1()
>>   {
>> -	sha1sum "$1"
>> +	if [ $# = 1 ]
>> +	then
>> +		sha1sum "$1"
>> +	else
>> +		sha1sum
>> +	fi
>          sha1sum "$@"
> Andreas.