From owner-freebsd-bugs@FreeBSD.ORG Sat Sep 30 12:50:30 2006 Return-Path: X-Original-To: freebsd-bugs@freebsd.org Delivered-To: freebsd-bugs@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B437D16A5AD for ; Sat, 30 Sep 2006 12:50:30 +0000 (UTC) (envelope-from ru@rambler-co.ru) Received: from relay0.rambler.ru (relay0.rambler.ru [81.19.66.187]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1E56C43D77 for ; Sat, 30 Sep 2006 12:50:17 +0000 (GMT) (envelope-from ru@rambler-co.ru) Received: from relay0.rambler.ru (localhost [127.0.0.1]) by relay0.rambler.ru (Postfix) with ESMTP id 399D65EC2; Sat, 30 Sep 2006 16:50:16 +0400 (MSD) Received: from edoofus.park.rambler.ru (unknown [81.19.65.108]) by relay0.rambler.ru (Postfix) with ESMTP id 183D85E55; Sat, 30 Sep 2006 16:50:16 +0400 (MSD) Received: (from ru@localhost) by edoofus.park.rambler.ru (8.13.8/8.13.8) id k8UCoJVK038819; Sat, 30 Sep 2006 16:50:19 +0400 (MSD) (envelope-from ru) Date: Sat, 30 Sep 2006 16:50:19 +0400 From: Ruslan Ermilov To: Bruce Evans Message-ID: <20060930125019.GB38718@rambler-co.ru> References: <200609300624.k8U6O9TM017192@www.freebsd.org> <20060930205828.M926@epsplex.bde.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="uQr8t48UFsdbeI+V" Content-Disposition: inline In-Reply-To: <20060930205828.M926@epsplex.bde.org> User-Agent: Mutt/1.5.13 (2006-08-11) X-Virus-Scanned: No virus found Cc: freebsd-bugs@freebsd.org, Helmut Schellong Subject: Re: bin/103845: sha256 /dev/acd0 returns immediately X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Sep 2006 12:50:31 -0000 --uQr8t48UFsdbeI+V Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Sep 30, 2006 at 09:51:45PM +1000, Bruce Evans wrote: > On Sat, 30 Sep 2006, Helmut Schellong wrote: >=20 > >>Description: > >sha256 /dev/acd0 returns *immediately* > >with a wrong checksum. > > > >CD content is BETA1-disc1. > > > >dd if=3D/dev/acd0 of=3D/usr/z bs=3D4b; sha256 /usr/z; rm /usr/z > >works fine. >=20 > md5(1) and friends haven't worked for files specified on the command > line since 2001. >=20 I think you meant to say "for device special files". $ md5 /bin/cat /bin/cp MD5 (/bin/cat) =3D 51c9c34f1d2db0f73d043929556a687b MD5 (/bin/cp) =3D b456419be246512f9fe3ac1cd4219331 $ cat /bin/cat | md5 51c9c34f1d2db0f73d043929556a687b $ cat /bin/cp | md5 b456419be246512f9fe3ac1cd4219331 > 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. >=20 > One workaround is to run md5 on 1 file at a time and not specify the > file on the command line. "md5 "filter" cases which doesn't go near the buggy code. >=20 > 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. >=20 > The workaround can also be used backwards to break the case where the > file or pipe is already open: "md5 /dev/stdin checksum of an empty file. Cheers, --=20 Ruslan Ermilov ru@FreeBSD.org FreeBSD committer --uQr8t48UFsdbeI+V Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (FreeBSD) iD8DBQFFHmgLqRfpzJluFF4RAssqAJ0eJapJF2SUQ9kR+zvCz5p/7hHPaQCfR9ti nvZ7S7822k8J0VO5r5Tgxoo= =ANf2 -----END PGP SIGNATURE----- --uQr8t48UFsdbeI+V--