md5sum broken?
Robert P. J. Day
rpjday at crashcourse.ca
Sat May 29 13:22:01 UTC 2010
On Sat, 29 May 2010, Chuck Kuecker wrote:
> The file that md5sum produced looks correct - a string of hex, and
> the path to the file.
>
> Perhaps an "AHA" - if I run md5sum on the file, and I am not in the
> directory with the file, the whole path and filename gets put into
> the md5 file. If the build script uses a shorter path, the file
> won't match.
>
> Experiment time. Moved into the directory with the patch file and
> made another md5 file - the filename is now stripped of the absolute
> path.
>
> That might be the problem, solved. I'll report back after the build
> runs.
um, yup, that would definitely be a problem but it goes back to what
i mentioned earlier. (i'm not bored and looking for something to do,
i'm just waiting for coffee to brew.)
you reproduced a diagnostic from your build system that read "Error:
corrupt md5 file" or something to that effect. but that's not what
the problem was. i tested md5sum just now with an erroneous filename
and got:
$ md5sum -c passwd.md5
md5sum: passwd: No such file or directory
passwd: FAILED open or read
md5sum: WARNING: 1 of 1 listed file could not be read
$
which is exactly what the problem was, of course -- the filename as it
was stored in the file was, technically, incorrect. but that doesn't
equate to a "corrupt" md5 file, so that's kind of a misleading
diagnostic you're printing.
normally (at which point i wax philosophical), i would get my build
system to generate a diagnostic corresponding to *precisely* why the
md5 check failed -- failed match, missing file, corrupt md5 file --
and print a diagnostic to match the error. and, normally, i would use
the exit code from the command to tell me. sadly, as i look at the
md5sum.c source, it's not helpful in that respect -- 0 for success, 1
for failure. at least as i read it.
you can still do it by grabbing the command output and grepping,
that's also an option.
rday
--
========================================================================
Robert P. J. Day Waterloo, Ontario, CANADA
Linux Consulting, Training and Kernel Pedantry.
Web page: http://crashcourse.ca
Twitter: http://twitter.com/rpjday
========================================================================
More information about the ubuntu-users
mailing list