LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 03-24-2023, 05:33 PM   #1
rahrah
Member
 
Registered: Jun 2008
Location: London, England
Distribution: Slackware
Posts: 32

Rep: Reputation: 51
Coreutils problem with sha1sum and other digests


Hi,

I've just been hit by a bug in md5sum/sha1sum from coreutils-9.2.

Essentially, in certain circumstances, a digest manifest, when checked against a changed file, will print OK. The utility still reports an error at the end of the run, but in big manifests, it's a pain finding the failing file.

Here's a trivial script showing the problem:

Code:
#!/bin/bash

TMPFS_DIR=$(mktemp -d --suffix=-coreutils-prob --tmpdir=$(/bin/pwd))
cd "$TMPFS_DIR"
echo "aaaa" > a.txt
echo "bbbb" > b.txt
sha1sum *.txt > sha1s.txt
sha1sum -c sha1s.txt 
echo "cccc" > b.txt
echo "After file change in b.txt"
sha1sum -c sha1s.txt
With output:
Code:
$ sh sha1bad.sh 
a.txt: OK
b.txt: OK
After file change in b.txt
a.txt: OK
b.txt: OK
sha1sum: WARNING: 1 computed checksum did NOT match
It seems this has already been fixed in:

git://git.sv.gnu.org/coreutils
commit: 76f2fb627118a26c25003dbd98c22c153b7ee1d2

but it's not been part of a release tag.

Apologies if this has already been reported.

===Rich
 
Old 03-24-2023, 05:56 PM   #2
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,917

Rep: Reputation: 5035Reputation: 5035Reputation: 5035Reputation: 5035Reputation: 5035Reputation: 5035Reputation: 5035Reputation: 5035Reputation: 5035Reputation: 5035Reputation: 5035
Thanks for the heads up.

Applied to coreutils-9.2 on my CRUX box and "FAILED" is showing up again.

Last edited by GazL; 03-24-2023 at 06:46 PM.
 
1 members found this post helpful.
Old 03-24-2023, 05:58 PM   #3
hpfeil
Member
 
Registered: Nov 2010
Location: Tucson, Arizona US
Distribution: Slackware Current
Posts: 357
Blog Entries: 1

Rep: Reputation: Disabled
`Sha1sum -c FILE` reads the checksums contained in FILE, then calculates the sums and compares the results with FILE. Seems to be working as advertised. From man sha1sum: --check "read checksums from the FILEs and check them"

"b.txt: OK" simply mans it parsed that line in FILE with no errors during the read phase. Then it moves on to the check phase and finds the discrepancy. It does not tell you whether it was a.txt or b.txt which contained the error.

Last edited by hpfeil; 03-24-2023 at 06:02 PM.
 
Old 03-24-2023, 07:29 PM   #4
rahrah
Member
 
Registered: Jun 2008
Location: London, England
Distribution: Slackware
Posts: 32

Original Poster
Rep: Reputation: 51
Quote:
Originally Posted by GazL View Post
Thanks for the heads up.

Applied to coreutils-9.2 on my CRUX box and "FAILED" is showing up again.
The patch from git seems to work on Slackware, too. Thanks for the feedback.

===Rich
 
2 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
sha1sum a folder and files? clifford227 Linux - Newbie 2 11-02-2010 05:23 PM
sha1sum How strong is it and can i change it by... helptonewbie Linux - Security 3 10-05-2007 06:13 PM
MD5 and SHA1SUM Problem niztec Linux - Software 8 07-14-2005 09:36 PM
Creating MD5 / SHA / SSHA digests from command line? [GOD]Anck Slackware 1 05-19-2005 11:00 AM
Daily and Weekly Digests Now Available jeremy LQ Suggestions & Feedback 1 01-07-2003 07:04 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 03:23 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration