Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 12 Aug 2001 12:28:42 +0200
From:      Joerg Wunsch <j@uriah.heep.sax.de>
To:        Mike Meyer <mwm@mired.org>
Cc:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/20725: Raw floppy writes fail for partial bytes.
Message-ID:  <20010812122842.I12441@uriah.heep.sax.de>
In-Reply-To: <15222.6738.319729.986142@guru.mired.org>; from mwm@mired.org on Sun, Aug 12, 2001 at 12:55:30AM -0500
References:  <200108101249.f7ACnWi99159@freefall.freebsd.org> <15222.6738.319729.986142@guru.mired.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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 <URL: http://www.uruk.org/orig-grub/install.html > -
> 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




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