From owner-freebsd-bugs Sun Aug 12 3:50:38 2001 Delivered-To: freebsd-bugs@freebsd.org Received: from sax.sax.de (sax.sax.de [193.175.26.33]) by hub.freebsd.org (Postfix) with ESMTP id 8748837B408 for ; Sun, 12 Aug 2001 03:50:32 -0700 (PDT) (envelope-from j@uriah.heep.sax.de) Received: (from uucp@localhost) by sax.sax.de (8.9.3/8.9.3) with UUCP id MAA08791; Sun, 12 Aug 2001 12:50:22 +0200 (CEST) Received: (from j@localhost) by uriah.heep.sax.de (8.11.4/8.11.4) id f7CASg589520; Sun, 12 Aug 2001 12:28:42 +0200 (MET DST) (envelope-from j) Date: Sun, 12 Aug 2001 12:28:42 +0200 From: Joerg Wunsch To: Mike Meyer Cc: freebsd-bugs@FreeBSD.org Subject: Re: bin/20725: Raw floppy writes fail for partial bytes. Message-ID: <20010812122842.I12441@uriah.heep.sax.de> Reply-To: Joerg Wunsch References: <200108101249.f7ACnWi99159@freefall.freebsd.org> <15222.6738.319729.986142@guru.mired.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0.1i In-Reply-To: <15222.6738.319729.986142@guru.mired.org>; from mwm@mired.org on Sun, Aug 12, 2001 at 12:55:30AM -0500 X-Phone: +49-351-2012 669 X-PGP-Fingerprint: DC 47 E6 E4 FF A6 E9 8F 93 21 E0 7D F9 12 D6 4E Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org As Mike Meyer wrote: > While I don't object to this being closed, I'd like for a couple of > comments to make it into the PR log. [In that case you gotta send it to freebsd-gnats-submit@freebsd.org.] > First, /dev/fd is historically not a raw device on FreeBSD, or Unix > in general. This means that instructions written for Unix in general > - like those at - > which used to work on FreeBSD are no longer correct. It could be argued that they haven't been correct at all. ;-) Buffered devices had solely one purpose: to mount a filesystem on top of them. Abusing them as a generic vehicle for lazy users to write unaligned data to it always could cause problems. One of the problems caused by it was the subject of PR 20725. Another of those problems i've seen years ago on DG/UX: writing only a few bytes to a buffered floppy device never got the data to the floppy, only to the buffer cache of the OS. You needed to shutdown the OS in order to get the data actually written. (An umount also causes them to be written, but you obviously cannot umount something you never mounted.) So you should point out that to people writing those instructions. Apparently, the GRUB instructions have been written by someone who knows mainly the Linux behaviour (which doesn't have raw devices at all, but instead implies some reliable semantics for buffered devices). > > Use a tool like tar or cpio when copying arbitrary stuff to raw > > devices. > > Those can't be used to build a boot floppy. The correct tool for > writing arbitrary data to a floppy is still dd, you just have to > account for their being no cooked floppy device: > > dd if=TESTFILE of=/dev/fd0 bs=512 conv=sync Normally, one would expect the tools that produce binary images for boot floppies to already implement this kind of padding. See the tools that produce FreeBSD boot floppies. So that's merely another flaw in GRUB; their `make' instructions should pad the data (and should also implement a check that the resulting data do not overflow the space constraints). -- cheers, J"org .-.-. --... ...-- -.. . DL8DTL http://www.sax.de/~joerg/ NIC: JW11-RIPE Never trust an operating system you don't have sources for. ;-) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message