i386/67773: 5.x series - md5 on dev no longer works e.g. md5 /dev/ad2

Bruce Evans bde at zeta.org.au
Thu Jun 10 10:18:01 GMT 2004


On Thu, 10 Jun 2004, Dan Fletcher wrote:

> >Description:
> I work computer forensics for a law enforcement agency.  I use FreeBSD extensively.  Tried to upgrade to 5.x series for the SATA support.  However the md5 checksum no longer works on raw devices.  I have tried it with 5.0 and 5.2.1, neither work.
>
> Worked fine with 4.x series.
>
> cksum of a raw device works fine, e.g.
> cksum /dev/ad2
> >How-To-Repeat:
> Try to md5 checksum any raw device:
>
> md5 /dev/fd0
> md5 /dev/ad2, etc.

This seems to have been broken in at least rev.1.14 of libmd/mdXhl.c
by using fstat() to determine a wrong size for the file.  fstat() only
gives the file size for regular files that don't change while being
read.  Pipes are handled differently, so the breakage doesn't affect
them.  Regular files that change while being read aren't handled very
well anyway.

As a workaround, pipe the file to md5 (e.g., cat /dev/ad2 | md5).

Bruce


More information about the freebsd-i386 mailing list