[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Ordering bug(?) with cksum/hashsum
From: |
Sylvestre Ledru |
Subject: |
Ordering bug(?) with cksum/hashsum |
Date: |
Sun, 26 May 2024 23:08:57 +0200 |
User-agent: |
Mozilla Thunderbird Beta |
Hello,
Playing with the one of the *sum command, i noticed a weird behavior.
Depending on the order in the checksum file, we will get completely
different results.
For example, this code reproduces the issue:
----
touch a
touch "*c"
echo "First test case:"
echo "d41d8cd98f00b204e9800998ecf8427e *c" > in.md5
echo "d41d8cd98f00b204e9800998ecf8427e a" >> in.md5
/usr/bin/md5sum --check in.md5
echo ""
echo "Second test case:"
echo "d41d8cd98f00b204e9800998ecf8427e a" > in.md5
echo "d41d8cd98f00b204e9800998ecf8427e *c" >> in.md5
/usr/bin/md5sum --check in.md5
----
Will return:
----
First test case:
/usr/bin/md5sum: c: No such file or directory
c: FAILED open or read
/usr/bin/md5sum: WARNING: 1 line is improperly formatted
/usr/bin/md5sum: WARNING: 1 listed file could not be read
Second test case:
a: OK
*c: OK
----
with:
md5sum (GNU coreutils) 9.4
Is that a bug?
I think I understand the technical reason even if I didn't check the
code. I guess the parser will look at the first line
and think that it the "double space format".
Thanks
Sylvestre
- Ordering bug(?) with cksum/hashsum,
Sylvestre Ledru <=