Re: 1.3.6[0-7] floppy driver broken

Linus Torvalds (torvalds@cs.helsinki.fi)
Fri, 23 Feb 1996 14:57:57 +0200 (EET)


> i get the following errormessages on: 1.3.60 and 1.3.67
>
> --
> toyland:~# dd if=/dev/zero of=/dev/fd0h1440
> dd: /dev/fd0h1440: No such file or directory
> 2881+0 records in
> 2880+0 records out
> --
> I think something in the floppy-driver is wrong.

I'm too lazy to check this out myself (I dislike floppies intensely, so I don't
have any available), but this _may_ be due to the floppy filling up, and 'dd'
being confused about that.

When the floppy fills up, it _should_ return a value of zero when it can't
write any more. Now, I don't know what "dd" does, but I've seen programs that
do things like this:

if (write(fd, buffer, size) != size) {
perror("device");
exit(1);
}

Now, the fallacy of this is that if the floppy driver returns zero to tell that
it's full and we can't write any more, the if-test will be true, and the
program does a "perror()" call, despite the fact that no error was actually
returned at all!

Now, perror() will print out whatever error message that "errno" indicates, and
depending on what has been done earlier, errno might be ENOENT (ie "no such
file or directory"). That's a reasonably normal error value for errno, because
the library tends to try to open configuration files etc until it finds one, so
errno is often ENOENT as a result of an earlier library call that succeeded
(but had to test a few places before doing so).

Now, you might run "strace" on dd to see if the system call really _is_
returning an error value, or if it just dd that is confused. I suspect it's dd.

Linus