md5sum doesn't document behavior for backslash-in-filename

Bug #53584 reported by Jonesy
6
Affects Status Importance Assigned to Milestone
coreutils (Ubuntu)
Fix Released
Low
Unassigned

Bug Description

Binary package hint: coreutils

Hi,
I think I may have discovered a bug in md5sum.

When I generate the checksum of a file with a backslash in the filename, it prepends a backslash to the hash, and then also escapes the backslash in the output filename. Please see example below:

$ md5sum "test\file"
\d41d8cd98f00b204e9800998ecf8427e test\\file

This was on ubuntu 6.06 and 5.10. Does not occur in Debian 3.1.

Thanks for your time,
Andrew Jones

Revision history for this message
Micah Cowan (micahcowan) wrote :

Wow, what an odd bug.

Changed in coreutils:
status: Unconfirmed → Confirmed
Revision history for this message
Micah Cowan (micahcowan) wrote :

Confirmed still a problem in feisty, and without the Ubuntu patches, and in upstream's latest (v6.9). Debian seems to be on 5.2.1, so the bug was apparently introduced since them.

Revision history for this message
Micah Cowan (micahcowan) wrote :

Okay.... /not/ a bug, apparently. The source-code for md5sum contains:

              /* Output a leading backslash if the file name contains
                 a newline or backslash. */
              if (strchr (file, '\n') || strchr (file, '\\'))
                putchar ('\\');

So, apparently, this is by design.

However, neither the manpage nor the infopage mentions this at all, so I would consider this a documentation bug, definitely.

It looks like the documentation has been fixed in CVS and at least the latest release, 6.9.

See http://<email address hidden>/msg09713.html

Micah Cowan (micahcowan)
Changed in coreutils:
assignee: nobody → micahcowan
importance: Undecided → Low
status: Confirmed → In Progress
Micah Cowan (micahcowan)
Changed in coreutils:
assignee: micahcowan → nobody
status: In Progress → Confirmed
Revision history for this message
Antoine Amarilli (a3nm) wrote :

It looks like this behaviour is now mentioned by the infopage:

"If FILE contains a backslash or newline, the line is started with a backslash, and each problematic character in the file name is escaped with a backslash, making the output unambiguous even in the presence of arbitrary file names."

Accordingly, this bug should be closed.

Phillip Susi (psusi)
Changed in coreutils (Ubuntu):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.