GNU bug report logs - #7739
bug in md5sum ?

Previous Next

Package: coreutils;

Reported by: Arnaud TARDY <hishiryo <at> free.fr>

Date: Sun, 26 Dec 2010 21:47:02 UTC

Severity: normal

Tags: moreinfo

Done: Bob Proulx <bob <at> proulx.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 7739 in the body.
You can then email your comments to 7739 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org:
bug#7739; Package coreutils. (Sun, 26 Dec 2010 21:47:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Arnaud TARDY <hishiryo <at> free.fr>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Sun, 26 Dec 2010 21:47:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Arnaud TARDY <hishiryo <at> free.fr>
To: bug-coreutils <at> gnu.org
Subject: bug in md5sum ?
Date: Sun, 26 Dec 2010 22:45:51 +0100
Hi,
I'm a french guy Arnaud TARDY. I used Linux but..md5sum are different
between Linux and Windows for a same word!! Exemple

Linux: echo 'somme' | md5sum
result: cc72185f414a55738ee4460aa82802b3

windows somme
Result: 3CE6E7F240E6B94C36FD0DDA70C213E9

Can you help me?
Thanks.
Arnaud TARDY

Linux: 2.6.31.14-desktop586-1nmb
version of md5sum :7.5




Information forwarded to owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org:
bug#7739; Package coreutils. (Mon, 27 Dec 2010 00:52:02 GMT) Full text and rfc822 format available.

Message #8 received at 7739 <at> debbugs.gnu.org (full text, mbox):

From: Bob Proulx <bob <at> proulx.com>
To: Arnaud TARDY <hishiryo <at> free.fr>
Cc: 7739 <at> debbugs.gnu.org
Subject: Re: bug#7739: bug in md5sum ?
Date: Sun, 26 Dec 2010 17:58:27 -0700
Arnaud TARDY wrote:
> [...] but..md5sum are different between Linux and Windows for a same
> word!! Exemple
> 
> Linux: echo 'somme' | md5sum
> result: cc72185f414a55738ee4460aa82802b3

Correct.  Don't forget that echo adds a newline (\n) to the end of the
line.

  $ echo 'somme' | md5sum
  cc72185f414a55738ee4460aa82802b3  -

  $ echo 'somme' | od -tx1 -c
  0000000  73  6f  6d  6d  65  0a
            s   o   m   m   e  \n
  0000006

> windows somme
> Result: 3CE6E7F240E6B94C36FD0DDA70C213E9

That would be the result of md5sum on that word without a newline on
the end.  You can see this by using printf instead of echo.  Printf
does not add a newline on the end of the line by default unless
directed by having a newline (\n) at the end of the string.

  $ printf 'somme' | md5sum
  3ce6e7f240e6b94c36fd0dda70c213e9  -

  $ printf 'somme' | od -tx1 -c
  0000000  73  6f  6d  6d  65
            s   o   m   m   e
  0000005

  $ printf 'somme\n' | md5sum
  cc72185f414a55738ee4460aa82802b3  -

  $ printf 'somme\n' | od -tx1 -c
  0000000  73  6f  6d  6d  65  0a
            s   o   m   m   e  \n
  0000006

As such I don't think this is a bug but a misunderstanding of the
effects of the newline at the end of the line.

Bob




Information forwarded to owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org:
bug#7739; Package coreutils. (Mon, 27 Dec 2010 02:13:01 GMT) Full text and rfc822 format available.

Message #11 received at 7739 <at> debbugs.gnu.org (full text, mbox):

From: Jon Stanley <jonstanley <at> gmail.com>
To: Arnaud TARDY <hishiryo <at> free.fr>
Cc: 7739 <at> debbugs.gnu.org
Subject: Re: bug#7739: bug in md5sum ?
Date: Sun, 26 Dec 2010 20:21:05 -0500
On Sun, Dec 26, 2010 at 4:45 PM, Arnaud TARDY <hishiryo <at> free.fr> wrote:

> Linux: echo 'somme' | md5sum
> result: cc72185f414a55738ee4460aa82802b3
>
> windows somme
> Result: 3CE6E7F240E6B94C36FD0DDA70C213E9
>
> Can you help me?

I think that you're seeing the difference in line termination
characters in Linux and Windows. If you just want the characters
themselves echoed to the command in Linux, you need to use 'echo -n'
otherwise it gets terminated with a newline.




Added tag(s) moreinfo. Request was from Bob Proulx <bob <at> proulx.com> to control <at> debbugs.gnu.org. (Mon, 27 Dec 2010 03:00:03 GMT) Full text and rfc822 format available.

Information forwarded to owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org:
bug#7739; Package coreutils. (Mon, 27 Dec 2010 20:14:02 GMT) Full text and rfc822 format available.

Message #16 received at 7739 <at> debbugs.gnu.org (full text, mbox):

From: Eric Blake <eblake <at> redhat.com>
To: Jon Stanley <jonstanley <at> gmail.com>
Cc: 7739 <at> debbugs.gnu.org, Arnaud TARDY <hishiryo <at> free.fr>
Subject: Re: bug#7739: bug in md5sum ?
Date: Mon, 27 Dec 2010 13:19:56 -0700
[Message part 1 (text/plain, inline)]
On 12/26/2010 06:21 PM, Jon Stanley wrote:
> 
> I think that you're seeing the difference in line termination
> characters in Linux and Windows. If you just want the characters
> themselves echoed to the command in Linux, you need to use 'echo -n'
> otherwise it gets terminated with a newline.

'echo -n' is non-portable.  You are better off conditioning yourself to
think about 'printf' rather than perpetuating the problems associated
with 'echo -n'.

-- 
Eric Blake   eblake <at> redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

[signature.asc (application/pgp-signature, attachment)]

Reply sent to Bob Proulx <bob <at> proulx.com>:
You have taken responsibility. (Sun, 10 Apr 2011 03:41:02 GMT) Full text and rfc822 format available.

Notification sent to Arnaud TARDY <hishiryo <at> free.fr>:
bug acknowledged by developer. (Sun, 10 Apr 2011 03:41:02 GMT) Full text and rfc822 format available.

Message #21 received at 7739-done <at> debbugs.gnu.org (full text, mbox):

From: Bob Proulx <bob <at> proulx.com>
To: Arnaud TARDY <hishiryo <at> free.fr>
Cc: 7739-done <at> debbugs.gnu.org
Subject: Re: bug#7739: bug in md5sum ?
Date: Sat, 9 Apr 2011 21:40:43 -0600
Bob Proulx wrote:
> Arnaud TARDY wrote:
> > [...] but..md5sum are different between Linux and Windows for a same
> > word!! Exemple
> > 
> > Linux: echo 'somme' | md5sum
> > result: cc72185f414a55738ee4460aa82802b3
> 
> Correct.  Don't forget that echo adds a newline (\n) to the end of the
> line.
> 
>   $ echo 'somme' | md5sum
>   cc72185f414a55738ee4460aa82802b3  -
> 
>   $ echo 'somme' | od -tx1 -c
>   0000000  73  6f  6d  6d  65  0a
>             s   o   m   m   e  \n
>   0000006
> 
> > windows somme
> > Result: 3CE6E7F240E6B94C36FD0DDA70C213E9
> 
> That would be the result of md5sum on that word without a newline on
> the end.  You can see this by using printf instead of echo.  Printf
> does not add a newline on the end of the line by default unless
> directed by having a newline (\n) at the end of the string.
> 
>   $ printf 'somme' | md5sum
>   3ce6e7f240e6b94c36fd0dda70c213e9  -
> 
>   $ printf 'somme' | od -tx1 -c
>   0000000  73  6f  6d  6d  65
>             s   o   m   m   e
>   0000005
> 
>   $ printf 'somme\n' | md5sum
>   cc72185f414a55738ee4460aa82802b3  -
> 
>   $ printf 'somme\n' | od -tx1 -c
>   0000000  73  6f  6d  6d  65  0a
>             s   o   m   m   e  \n
>   0000006
> 
> As such I don't think this is a bug but a misunderstanding of the
> effects of the newline at the end of the line.

There were several messages and suggestions in response to your bug
report.  It has been several months without a response from you.  I
can only assume that the problem has been resolved.  Therefore I am
closing this bug report.

Thanks for helping to improve GNU!

Bob




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 08 May 2011 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 14 years and 103 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.