Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Jun 2004 20:17:54 +1000 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Dan Fletcher <drfmail@swbell.net>
Cc:        freebsd-i386@freebsd.org
Subject:   Re: i386/67773: 5.x series - md5 on dev no longer works e.g. md5 /dev/ad2
Message-ID:  <20040610200723.W8324@gamplex.bde.org>
In-Reply-To: <200406100218.i5A2IfNe034850@www.freebsd.org>
References:  <200406100218.i5A2IfNe034850@www.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040610200723.W8324>