bug#77934: bug: md5sum: Escaped backslashes in filename got in stdout

Pádraig Brady <[email protected]>
Newsgroups gmane.comp.gnu.core-utils.bugs
Message-ID <[email protected]>
tag 77934 notabug
close 77934
stop

On 20/04/2025 00:44, William Johnson via GNU coreutils Bug Reports wrote:
> Hello. I would like to report a bug for md5sum coreutil.
> If filename has ‘\t’ in filename, stdout for md5sum result will start with backslash symbol.
>   
> *  My version of md5sum util:
> md5sum --version
> md5sum (GNU coreutils) 8.32
>   
> *  Set of commands to reproduce:
> $ touch hello
> $ touch hello\t\\t\\\t\\\\t
> $ md5sum ./*
> d41d8cd98f00b204e9800998ecf8427e  ./hello
> \d41d8cd98f00b204e9800998ecf8427e  ./hellot\\t\\t\\\\t
>   
> *  Expected no backshash symbol in stdout line 2. This is not  a big deal as files with backslashes in names are rare, but if someone process md5sums with regexp this case might ruin their work. Theoretically.
> Thank you.

That's expected and documented behavior.
Consider using --zero for programmatic use of these utilities,
in which case the escaping is not used (required).

cheers,
Pádraig
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.