bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: sha*sum and filenames with backslashes


From: Steve Ward
Subject: Re: sha*sum and filenames with backslashes
Date: Fri, 6 Jul 2007 01:39:12 -0400

On 7/4/07, Eric Blake <address@hidden> wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Geoff Kuenning on 7/3/2007 6:01 PM:
> When the *sum family of programs are given a filename that contains
> a backslash, a spurious backslash is given at the beginning of the
> output line.
>
> This appears to be a feature, since it's explicitly in the code.
> However it isn't documented, which can cause surprises for programs
> that expect to parse the output of *sum.

This was previously brought up, and a documentation patch was provided in
time for coreutils 6.9.
http://lists.gnu.org/archive/html/bug-coreutils/2007-03/msg00173.html

Sounds like you need to upgrade.

[However, this does point out that I have not yet had time to focus on my
patch for getting \r to be treated like \\ and \n in the *sum output.]

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at 
home.comcast.net/~ericblake/eblake.gpg<http://home.comcast.net/%7Eericblake/eblake.gpg>
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGjBZe84KuGfSFAYARAp1JAJ0cbwfM7rsusC6r6u+D25xkYKkHlwCeIZqb
qhl73wJImcTZEe1VRRgd1FU=
=HNA4
-----END PGP SIGNATURE-----


_______________________________________________
Bug-coreutils mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/bug-coreutils



Instead of handling some specific control characters (\n and \r) and the
backslash, what about using something like the "quoting-style" functionality
used by 'ls'?  I think it would be a more general solution.

Attached is a little script I made (along with its output).  It touches some
files with control characters in their names.  Then the mechanism of
escaping file names in md5sum is shown, followed by each quoting style
available in 'ls'.  The purpose is to show different ways the *sum programs
could handle the display of file names with control characters (or just
escapable characters).

BTW, I'm not suggesting that there be a "--quoting-style=" command line
option in the *sum programs, but rather the style be internal.
I personally think the "escape" quoting style would best fit what md5sum
already does, but I guess it really depends on who's going to be reading the
file names (human, shell, etc.).


Steve Ward



address@hidden ~]$ md5sum --version
md5sum (GNU coreutils) 6.9
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software.  You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.

Written by Ulrich Drepper, Scott Miller, and David Madore.

Attachment: test_md5sum_quoting_style.sh
Description: Bourne shell script

Attachment: test_md5sum_quoting_style_output.txt
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]