GNU bug report logs - #66519
b2sum, md5sum sha*sum etc broken on filenames including backslash

Previous Next

Package: coreutils;

Reported by: "Simon Richter M. Sc." <simon.richter <at> uni-paderborn.de>

Date: Fri, 13 Oct 2023 13:24:01 UTC

Severity: normal

Tags: notabug

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 66519 in the body.
You can then email your comments to 66519 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#66519; Package coreutils. (Fri, 13 Oct 2023 13:24:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Simon Richter M. Sc." <simon.richter <at> uni-paderborn.de>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Fri, 13 Oct 2023 13:24:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "Simon Richter M. Sc." <simon.richter <at> uni-paderborn.de>
To: bug-coreutils <at> gnu.org
Subject: b2sum, md5sum sha*sum etc broken on filenames including backslash
Date: Fri, 13 Oct 2023 14:31:18 +0200
I noticed some broken checksums with leading backslash and wrong 
filenames in my checksum files because the original filenames contained 
a backslash.

Way to reproduce:
% touch test\\test.file
% b2sum test\\test.file

expected output:
786a02f742015903c6c6fd852552d272912f4740e15847618a86e217f71f5419d25e1031afee585313896444934eb04b903a685b1448b755d56f701afe9be2ce 
 test\test.file

real broken output:
\786a02f742015903c6c6fd852552d272912f4740e15847618a86e217f71f5419d25e1031afee585313896444934eb04b903a685b1448b755d56f701afe9be2ce 
 test\\test.file


Tested with coreutils 9.3 and coreutils 9.4 and LC_ALL=C
Btw any chance we get b3sum included in coreutils?





Information forwarded to bug-coreutils <at> gnu.org:
bug#66519; Package coreutils. (Fri, 13 Oct 2023 14:22:01 GMT) Full text and rfc822 format available.

Message #8 received at 66519 <at> debbugs.gnu.org (full text, mbox):

From: Pádraig Brady <P <at> draigBrady.com>
To: "Simon Richter M. Sc." <simon.richter <at> uni-paderborn.de>,
 66519 <at> debbugs.gnu.org
Subject: Re: bug#66519: b2sum, md5sum sha*sum etc broken on filenames
 including backslash
Date: Fri, 13 Oct 2023 15:21:03 +0100
tag 66519 notabug
close 66519
stop

On 13/10/2023 13:31, Simon Richter M. Sc. wrote:
> I noticed some broken checksums with leading backslash and wrong
> filenames in my checksum files because the original filenames contained
> a backslash.
> 
> Way to reproduce:
> % touch test\\test.file
> % b2sum test\\test.file
> 
> expected output:
> 786a02f742015903c6c6fd852552d272912f4740e15847618a86e217f71f5419d25e1031afee585313896444934eb04b903a685b1448b755d56f701afe9be2ce
>    test\test.file
> 
> real broken output:
> \786a02f742015903c6c6fd852552d272912f4740e15847618a86e217f71f5419d25e1031afee585313896444934eb04b903a685b1448b755d56f701afe9be2ce
>    test\\test.file

This is expected.
File names with problematic characters like \n are escaped as above.
Note we escape '\' itself to provide some forward compatibility
to introduce escaping of other characters.

> Tested with coreutils 9.3 and coreutils 9.4 and LC_ALL=C
> Btw any chance we get b3sum included in coreutils?

Yes we'll look at this,
but it will only be provided through the `cksum -a blake3` interface.

cheers,
Pádraig




Added tag(s) notabug. Request was from Pádraig Brady <P <at> draigBrady.com> to control <at> debbugs.gnu.org. (Fri, 13 Oct 2023 14:22:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 66519 <at> debbugs.gnu.org and "Simon Richter M. Sc." <simon.richter <at> uni-paderborn.de> Request was from Pádraig Brady <P <at> draigBrady.com> to control <at> debbugs.gnu.org. (Fri, 13 Oct 2023 14:22:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-coreutils <at> gnu.org:
bug#66519; Package coreutils. (Tue, 17 Oct 2023 13:10:02 GMT) Full text and rfc822 format available.

Message #15 received at 66519 <at> debbugs.gnu.org (full text, mbox):

From: "Simon Richter M. Sc." <simon.richter <at> uni-paderborn.de>
To: Pádraig Brady <P <at> draigBrady.com>, 66519 <at> debbugs.gnu.org
Subject: Re: bug#66519: b2sum, md5sum sha*sum etc broken on filenames
 including backslash
Date: Tue, 17 Oct 2023 10:22:58 +0200
No that doesn't make sense, this can't be intended behaviour, even if 
you escape the backslash there should be no backslash in the beginning 
of the checksum!

On 13.10.23 16:21, Pádraig Brady wrote:
> tag 66519 notabug
> close 66519
> stop
> 
> On 13/10/2023 13:31, Simon Richter M. Sc. wrote:
>> I noticed some broken checksums with leading backslash and wrong
>> filenames in my checksum files because the original filenames contained
>> a backslash.
>>
>> Way to reproduce:
>> % touch test\\test.file
>> % b2sum test\\test.file
>>
>> expected output:
>> 786a02f742015903c6c6fd852552d272912f4740e15847618a86e217f71f5419d25e1031afee585313896444934eb04b903a685b1448b755d56f701afe9be2ce 
>>
>>    test\test.file
>>
>> real broken output:
>> \786a02f742015903c6c6fd852552d272912f4740e15847618a86e217f71f5419d25e1031afee585313896444934eb04b903a685b1448b755d56f701afe9be2ce 
>>
>>    test\\test.file
> 
> This is expected.
> File names with problematic characters like \n are escaped as above.
> Note we escape '\' itself to provide some forward compatibility
> to introduce escaping of other characters.
> 
>> Tested with coreutils 9.3 and coreutils 9.4 and LC_ALL=C
>> Btw any chance we get b3sum included in coreutils?
> 
> Yes we'll look at this,
> but it will only be provided through the `cksum -a blake3` interface.
> 
> cheers,
> Pádraig





Information forwarded to bug-coreutils <at> gnu.org:
bug#66519; Package coreutils. (Tue, 17 Oct 2023 13:27:02 GMT) Full text and rfc822 format available.

Message #18 received at 66519 <at> debbugs.gnu.org (full text, mbox):

From: "Glenn Golden" <gdg <at> zplane.com>
To: "Simon Richter M. Sc." <simon.richter <at> uni-paderborn.de>
Cc: 66519 <at> debbugs.gnu.org, Pádraig Brady <P <at> draigBrady.com>
Subject: Re: bug#66519: b2sum, md5sum sha*sum etc broken on filenames including
 backslash
Date: Tue, 17 Oct 2023 07:25:49 -0600

On Tue, Oct 17, 2023, at 02:22, Simon Richter M. Sc. wrote:
>
> No that doesn't make sense, this can't be intended behaviour, even if 
> you escape the backslash there should be no backslash in the beginning 
> of the checksum!
>

It is intended and documented as such. From coreutils.info (9.3):

   "Without ‘--zero’, if FILE contains a backslash, newline, or carriage
    return, 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."

You can argue that it ought to have been done differently, but it is the 
documented behavior.

Glenn Golden





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 16 Nov 2023 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 309 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.