Olivier Delhomme wrote:
On Sun, 03 Apr 2005 23:34:00 +0100, Steve Lilly was saying :
Dear GNU,
I was testing one of my own scripts for robustness against exotic filenames containing "\" when I noticed a peculiar behaviour from the md5sum utility (version 5.2.1). To demonstrate:
[EMAIL PROTECTED] test]$ touch test\\test [EMAIL PROTECTED] test]$ ls test\test [EMAIL PROTECTED] test]$ md5sum * \d41d8cd98f00b204e9800998ecf8427e test\\test
I have tried this with bash and tcsh. ls confirms the file has a single \ character. It appears (to me at least) that md5sum is escaping the \ to \\, but I'm baffled as to the extra \ at the beginning of the hash!
Here I have coreutils 5.2.1, debian 3.1 unstable, bash 3.00.16(1) and I can not reproduce your problem. The hash value is correct and without the \ at the beginning.
Please could you tell us which is your system and bash version ?
Regards,
Steve Lilly
Regards, Olivier Delhomme.
GNU bash, version 2.05b.0(1)-release (i386-redhat-linux-gnu) Fedora Core release 2 (Tettnang)
On a little further investigation, I think I have found the culprit in md5sum.c:
230:
/* Ignore this line if it is too short.
Each line must have at least `min_digest_line_length - 1' (or one more, if
the first is a backslash) more characters to contain correct message digest
information. */
if (s_len - i < min_digest_line_length + (s[i] == '\\'))
return 1;
if (s[i] == '\\') { ++i; escaped_filename = 1; }
693: /* Output a leading backslash if the file name contains a newline or backslash. */ if (strchr (file, '\n') || strchr (file, '\\')) putchar ('\\');
So it appears to be intended behaviour, though why I'm not sure...
Steve Lilly.
_______________________________________________ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils