Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 30 Sep 2006 12:00:42 GMT
From:      Bruce Evans <bde@zeta.org.au>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/103845: sha256 /dev/acd0  returns immediately
Message-ID:  <200609301200.k8UC0gj6021653@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/103845; it has been noted by GNATS.

From: Bruce Evans <bde@zeta.org.au>
To: Helmut Schellong <var@schellong.biz>
Cc: freebsd-gnats-submit@freebsd.org, freebsd-bugs@freebsd.org
Subject: Re: bin/103845: sha256 /dev/acd0  returns immediately
Date: Sat, 30 Sep 2006 21:51:45 +1000 (EST)

 On Sat, 30 Sep 2006, Helmut Schellong wrote:
 
 >> Description:
 > sha256 /dev/acd0  returns *immediately*
 > with a wrong checksum.
 >
 > CD content is BETA1-disc1.
 >
 > dd if=/dev/acd0 of=/usr/z bs=4b; sha256 /usr/z; rm /usr/z
 > works fine.
 
 md5(1) and friends haven't worked for files specified on the command
 line since 2001.  At least for md5, this is due to a bug in libmd.
 MDXFileChunk() has been used to implement MDXFile() since 2001, but
 MDXFileChunk() cannot be used for this since it assumes that the file
 is a regular file (or perhaps a symlink) so that st_size is valid and
 the file is seekable.
 
 One workaround is to run md5 on 1 file at a time and not specify the
 file on the command line.  "md5 </dev/acd0" works because it uses the
 "filter" cases which doesn't go near the buggy code.
 
 Another workaround is to use a pipeline: "cat /dev/acd0 | md5".  For
 pipes, it is essential that md5 act as a filter.  However, the previous
 workaround is better if you don't start with a pipe.
 
 The workaround can also be used backwards to break the case where the
 file or pipe is already open: "md5 /dev/stdin </dev/acd0" gives the
 checksum of an empty file.
 
 Bruce



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