Subject: Re: bug#7739: bug in md5sum ?

From: Bob Proulx <[email-masked]>
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