* [GUILT] [PATCH] Fix fatal "guilt graph" error in sha1sum invocation.
@ 2012-03-14 13:34 Per Cederqvist
2012-03-14 14:21 ` Jeff Sipek
2012-03-14 14:27 ` Andreas Schwab
0 siblings, 2 replies; 6+ messages in thread
From: Per Cederqvist @ 2012-03-14 13:34 UTC (permalink / raw)
To: Jeff Sipek; +Cc: git, ceder
Fix the compatibility function sha1 so that it reads from
stdin (and not a file with a zero-length file name) when
no argument is supplied.
Signed-off-by: Per Cederqvist <cederp@opera.com>
---
os.Darwin | 7 ++++++-
os.Linux | 7 ++++++-
os.SunOS | 7 ++++++-
3 files changed, 18 insertions(+), 3 deletions(-)
Note: I have tested both versions of the sha1 function, but only on
Linux as I don't have access to a Mac.
/ceder
diff --git a/os.Darwin b/os.Darwin
index 470f5fb..acf6b68 100644
--- a/os.Darwin
+++ b/os.Darwin
@@ -27,7 +27,12 @@ head_n()
# usage: sha1 [file]
sha1()
{
- 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,$, -,'
+ fi
}
# usage: cp_a <src> <dst>
diff --git a/os.Linux b/os.Linux
index 30b9cb0..aaebf88 100644
--- a/os.Linux
+++ b/os.Linux
@@ -30,7 +30,12 @@ head_n()
# usage: sha1 [file]
sha1()
{
- sha1sum "$1"
+ if [ $# = 1 ]
+ then
+ sha1sum "$1"
+ else
+ sha1sum
+ fi
}
# usage: cp_a <src> <dst>
diff --git a/os.SunOS b/os.SunOS
index 30b9cb0..aaebf88 100644
--- a/os.SunOS
+++ b/os.SunOS
@@ -30,7 +30,12 @@ head_n()
# usage: sha1 [file]
sha1()
{
- sha1sum "$1"
+ if [ $# = 1 ]
+ then
+ sha1sum "$1"
+ else
+ sha1sum
+ fi
}
# usage: cp_a <src> <dst>
--
1.7.9
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [GUILT] [PATCH] Fix fatal "guilt graph" error in sha1sum invocation.
2012-03-14 13:34 [GUILT] [PATCH] Fix fatal "guilt graph" error in sha1sum invocation Per Cederqvist
@ 2012-03-14 14:21 ` Jeff Sipek
2012-03-14 14:27 ` Andreas Schwab
1 sibling, 0 replies; 6+ messages in thread
From: Jeff Sipek @ 2012-03-14 14:21 UTC (permalink / raw)
To: Per Cederqvist; +Cc: git, ceder
On Wed, Mar 14, 2012 at 02:34:38PM +0100, Per Cederqvist wrote:
> Fix the compatibility function sha1 so that it reads from
> stdin (and not a file with a zero-length file name) when
> no argument is supplied.
I just ran into this yesterday. I stupidly changed the caller of sha1 to
pass in - for the filename. That worked for me since I ended up using the
sha1sum implementations; openssl is not happy about that. So, your patch
looks good.
Now, I should actually figure out how to get the git repo out there again.
Thanks,
Jeff.
> Signed-off-by: Per Cederqvist <cederp@opera.com>
> ---
> os.Darwin | 7 ++++++-
> os.Linux | 7 ++++++-
> os.SunOS | 7 ++++++-
> 3 files changed, 18 insertions(+), 3 deletions(-)
>
> Note: I have tested both versions of the sha1 function, but only on
> Linux as I don't have access to a Mac.
>
> /ceder
>
> diff --git a/os.Darwin b/os.Darwin
> index 470f5fb..acf6b68 100644
> --- a/os.Darwin
> +++ b/os.Darwin
> @@ -27,7 +27,12 @@ head_n()
> # usage: sha1 [file]
> sha1()
> {
> - 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,$, -,'
> + fi
> }
>
> # usage: cp_a <src> <dst>
> diff --git a/os.Linux b/os.Linux
> index 30b9cb0..aaebf88 100644
> --- a/os.Linux
> +++ b/os.Linux
> @@ -30,7 +30,12 @@ head_n()
> # usage: sha1 [file]
> sha1()
> {
> - sha1sum "$1"
> + if [ $# = 1 ]
> + then
> + sha1sum "$1"
> + else
> + sha1sum
> + fi
> }
>
> # usage: cp_a <src> <dst>
> diff --git a/os.SunOS b/os.SunOS
> index 30b9cb0..aaebf88 100644
> --- a/os.SunOS
> +++ b/os.SunOS
> @@ -30,7 +30,12 @@ head_n()
> # usage: sha1 [file]
> sha1()
> {
> - sha1sum "$1"
> + if [ $# = 1 ]
> + then
> + sha1sum "$1"
> + else
> + sha1sum
> + fi
> }
>
> # usage: cp_a <src> <dst>
> --
> 1.7.9
>
--
Only two things are infinite, the universe and human stupidity, and I'm not
sure about the former.
- Albert Einstein
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [GUILT] [PATCH] Fix fatal "guilt graph" error in sha1sum invocation.
2012-03-14 13:34 [GUILT] [PATCH] Fix fatal "guilt graph" error in sha1sum invocation Per Cederqvist
2012-03-14 14:21 ` Jeff Sipek
@ 2012-03-14 14:27 ` Andreas Schwab
2012-03-15 8:42 ` Per Cederqvist
1 sibling, 1 reply; 6+ messages in thread
From: Andreas Schwab @ 2012-03-14 14:27 UTC (permalink / raw)
To: Per Cederqvist; +Cc: Jeff Sipek, git
Per Cederqvist <cederp@opera.com> 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
> # usage: sha1 [file]
> sha1()
> {
> - sha1sum "$1"
> + if [ $# = 1 ]
> + then
> + sha1sum "$1"
> + else
> + sha1sum
> + fi
sha1sum "$@"
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [GUILT] [PATCH] Fix fatal "guilt graph" error in sha1sum invocation.
2012-03-14 14:27 ` Andreas Schwab
@ 2012-03-15 8:42 ` Per Cederqvist
2012-03-15 9:49 ` Andreas Schwab
2012-03-15 9:56 ` John Szakmeister
0 siblings, 2 replies; 6+ messages in thread
From: Per Cederqvist @ 2012-03-15 8:42 UTC (permalink / raw)
To: Andreas Schwab; +Cc: Jeff Sipek, git, ceder
On 03/14/2012 03:27 PM, Andreas Schwab wrote:
> Per Cederqvist<cederp@opera.com> 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.
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [GUILT] [PATCH] Fix fatal "guilt graph" error in sha1sum invocation.
2012-03-15 8:42 ` Per Cederqvist
@ 2012-03-15 9:49 ` Andreas Schwab
2012-03-15 9:56 ` John Szakmeister
1 sibling, 0 replies; 6+ messages in thread
From: Andreas Schwab @ 2012-03-15 9:49 UTC (permalink / raw)
To: Per Cederqvist; +Cc: Jeff Sipek, git, ceder
Per Cederqvist <cederp@opera.com> writes:
> On 03/14/2012 03:27 PM, Andreas Schwab wrote:
>
>> Per Cederqvist<cederp@opera.com> 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?
No.
$ openssl version
OpenSSL 1.0.0e 6 Sep 2011
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [GUILT] [PATCH] Fix fatal "guilt graph" error in sha1sum invocation.
2012-03-15 8:42 ` Per Cederqvist
2012-03-15 9:49 ` Andreas Schwab
@ 2012-03-15 9:56 ` John Szakmeister
1 sibling, 0 replies; 6+ messages in thread
From: John Szakmeister @ 2012-03-15 9:56 UTC (permalink / raw)
To: Per Cederqvist; +Cc: Andreas Schwab, Jeff Sipek, git, ceder
On Thu, Mar 15, 2012 at 4:42 AM, Per Cederqvist <cederp@opera.com> wrote:
> On 03/14/2012 03:27 PM, Andreas Schwab wrote:
>
>> Per Cederqvist<cederp@opera.com> 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?
Here's the output from my Mac (running Snow Leopard):
$ openssl dgst -sha1</dev/null
(stdin)= da39a3ee5e6b4b0d3255bfef95601890afd80709
$ openssl version
OpenSSL 1.0.0d 8 Feb 2011
-John
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-03-15 9:57 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-14 13:34 [GUILT] [PATCH] Fix fatal "guilt graph" error in sha1sum invocation Per Cederqvist
2012-03-14 14:21 ` Jeff Sipek
2012-03-14 14:27 ` Andreas Schwab
2012-03-15 8:42 ` Per Cederqvist
2012-03-15 9:49 ` Andreas Schwab
2012-03-15 9:56 ` John Szakmeister
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).