LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 02-09-2012, 03:41 PM   #1
brodo
Member
 
Registered: Jan 2004
Location: Poland, Poznan
Distribution: Slackware current 32 / 64
Posts: 406

Rep: Reputation: 30
md5sum from coreutils 8.15 "--check" option


It seems that the latest md5sum from coreutils package (8.15)
behaves differently than it used to in previous versions.

Invoking md5sum with "--check" option to check directory files against a text file containing computed md5sums gives no valid result.

Restoring previous md5sum version from coreutils package 8.12 fixed
this problem.
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 02-09-2012, 04:39 PM   #2
Alien Bob
Slackware Contributor
 
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 8,559

Rep: Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106
I can not reproduce this on slackware64-current with "coreutils-8.15-x86_64-1" installed.

I tested on a random file:
Code:
$ md5sum wine-1.3.37.tar.bz2 > MD5SUMS
$ md5sum test/wine-1.3.37.tar.bz2 >> MD5SUMS
$ md5sum --check MD5SUMS 
wine-1.3.37.tar.bz2: OK
test/wine-1.3.37.tar.bz2: OK
Eric
 
Old 02-09-2012, 05:24 PM   #3
willysr
Senior Member
 
Registered: Jul 2004
Location: Jogja, Indonesia
Distribution: Slackware-Current
Posts: 4,661

Rep: Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784
I'm having this problem on -Current (32 bit)
Code:
md5sum -c CHECKSUMS.md5 | less
md5sum:  ./ANNOUNCE.13_37: No such file or directory
md5sum:  ./BOOTING.TXT: No such file or directory
the file exists as it's a local mirror of Slackware-Current
 
Old 02-09-2012, 06:26 PM   #4
Alien Bob
Slackware Contributor
 
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 8,559

Rep: Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106
Seems like the newer md5sum has issues with a CHECKSUMS file containing more than just md5 checksums... if you delete the header lines from Slackware's CHECKSUMS.md5 and only leave the actual checksum lines, then the command "md5sum -c CHECKSUMS.md5" works.

Eric
 
Old 02-09-2012, 07:58 PM   #5
willysr
Senior Member
 
Registered: Jul 2004
Location: Jogja, Indonesia
Distribution: Slackware-Current
Posts: 4,661

Rep: Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784
Quote:
Originally Posted by Alien Bob View Post
Seems like the newer md5sum has issues with a CHECKSUMS file containing more than just md5 checksums... if you delete the header lines from Slackware's CHECKSUMS.md5 and only leave the actual checksum lines, then the command "md5sum -c CHECKSUMS.md5" works.
Yes, i think you are right about this one
it's a bug upstream, but i still haven't found any discussion on the coreutils list so far
 
Old 02-10-2012, 04:18 AM   #6
brodo
Member
 
Registered: Jan 2004
Location: Poland, Poznan
Distribution: Slackware current 32 / 64
Posts: 406

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by Alien Bob View Post
Seems like the newer md5sum has issues with a CHECKSUMS file containing more than just md5 checksums... if you delete the header lines from Slackware's CHECKSUMS.md5 and only leave the actual checksum lines, then the command "md5sum -c CHECKSUMS.md5" works.

Eric

Yes, deleting header infos from the beginning of the CHECKSUMS.md5 file fixed this.
I am using 32-bit current Slack.

Thanks.
 
Old 02-10-2012, 05:56 AM   #7
MadMaverick9
Member
 
Registered: Aug 2010
Posts: 353
Blog Entries: 4

Rep: Reputation: Disabled
This happens because "md5sum" now detects "bsd reversed" format:
Code:
2c2
<    Copyright (C) 1995-2011 Free Software Foundation, Inc.
---
>    Copyright (C) 1995-2012 Free Software Foundation, Inc.
102c102
<    + 2 /* blank and binary indicator */ \
---
>    + 1 /* blank */ \
124a125,131
> /* With --check, exit with a non-zero return code if any line is
>    improperly formatted. */
> static bool strict = false;
> 
> /* Whether a BSD reversed format checksum is detected.  */
> static int bsd_reversed = -1;
> 
130c137,138
<   QUIET_OPTION
---
>   QUIET_OPTION,
>   STRICT_OPTION
140a149
>   { "strict", no_argument, NULL, STRICT_OPTION },
189a199,201
>       fputs (_("\
>       --strict         with --check, exit non-zero for any invalid input\n\
> "), stdout);
196,197c208,209
< a line with checksum, a character indicating type (`*' for binary, ` ' for\n\
< text), and name for each FILE.\n"),
---
> a line with checksum, a character indicating input mode (`*' for binary,\n\
> space for text), and name for each FILE.\n"),
301,303c313,330
<   if (s[i] != ' ' && s[i] != '*')
<     return false;
<   *binary = (s[i++] == '*');
---
>   /* If "bsd reversed" format detected.  */
>   if ((s_len - i == 1) || (s[i] != ' ' && s[i] != '*'))
>     {
>       /* Don't allow mixing bsd and standard formats,
>          to minimize security issues with attackers
>          renaming files with leading spaces.
>          This assumes that with bsd format checksums
>          that the first file name does not have
>          a leading ' ' or '*'.  */
>       if (bsd_reversed == 0)
>         return false;
>       bsd_reversed = 1;
>     }
>   else if (bsd_reversed != 1)
>     {
>       bsd_reversed = 0;
>       *binary = (s[i++] == '*');
>     }
358c385
< static bool
---
> static bool _GL_ATTRIBUTE_PURE
436a464
>   uintmax_t n_improperly_formatted_lines = 0;
503a532,533
> 
>           ++n_improperly_formatted_lines;
606c636,637
<           && n_open_or_read_failures == 0);
---
>           && n_open_or_read_failures == 0
>           && (!strict || n_improperly_formatted_lines == 0));
659a691,693
>       case STRICT_OPTION:
>         strict = true;
>         break;
695a730,736
> 
>   if (strict & !do_check)
>    {
>      error (0, 0,
>         _("the --strict option is meaningful only when verifying checksums"));
>      usage (EXIT_FAILURE);
>    }
The header info in "CHECKSUMS.MD5" causes "md5sum" to set "bsd_reversed" to "1".
Quote:
Don't allow mixing bsd and standard formats, to minimize security issues with attackers renaming files with leading spaces.
From then on "md5sum" expects all following checksums to be in "bsd reversed" format, which they are not of course, and therefor all fails.

I verified this by changing all lines in "CHECKSUMS.MD5" to "bsd reversed" format and all works well.
Code:
sed 's/  / /' CHECKSUMS.md5 | md5sum --check
"bsd reversed" format has only one space between hash and filename.
 
4 members found this post helpful.
Old 02-10-2012, 07:11 AM   #8
MadMaverick9
Member
 
Registered: Aug 2010
Posts: 353
Blog Entries: 4

Rep: Reputation: Disabled
I found the following in the "md5sum" source code:
Code:
      /* Ignore comment lines, which begin with a '#' character.  */
      if (line[0] == '#')
	continue;
This is the source code from 2005 http://git.savannah.gnu.org/cgit/cor...e4d37a4cd#n424

And here the latest source code http://git.savannah.gnu.org/cgit/cor...3f21431da#n509
 
Old 02-10-2012, 09:19 AM   #9
willysr
Senior Member
 
Registered: Jul 2004
Location: Jogja, Indonesia
Distribution: Slackware-Current
Posts: 4,661

Rep: Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784
Here's the commit code http://git.savannah.gnu.org/gitweb/?...0e9a35fd89da3b
 
  


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
bash script: using "select" to show multi-word options? (like "option 1"/"o zidane_tribal Programming 7 12-19-2015 01:03 AM
unpredictable "delete" "move to trash" or "cut" file menu option dorianrenato Linux - General 3 11-28-2011 06:41 PM
[SOLVED] "C preprocessor "/lib/cpp" fails sanity check" every single time. masmddr Linux - Software 3 08-03-2010 10:37 AM
glibc 2.9 "make check" fails on rt/tst-cputimer with "timer sig[12] invoked to soon" shachter Linux - Software 2 02-14-2009 01:24 PM
anging "Protocol" option to "IMPS/2" in XF86Config-4 causes problems zstingx Linux - General 2 10-27-2003 09:47 AM

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

All times are GMT -5. The time now is 05:05 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