Re: 1.3.6[0-7] floppy driver broken

Alain Knaff (Alain.Knaff@imag.fr)
Sun, 25 Feb 1996 20:48:13 +0100


>> 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 tha
>t
>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!

As you suggested, I ran an strace on strace dd if=/dev/zero
of=/dev/fd0. Here are its final lines:

write(2, "dd: ", 4dd: ) = 4
write(2, "/dev/fd0", 8/dev/fd0) = 8
write(2, ": No such file or directory", 27: No such file or directory) = 27
write(2, "\n", 1
) = 1
write(2, "2881+0 records in\n", 182881+0 records in
) = 18
write(2, "2880+0 records out\n", 192880+0 records out
) = 19
close(3) = 0
close(4) = 0
_exit(1) = ?

>
>Now, perror() will print out whatever error message that "errno" indicates, an
>d
>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, s
>o
>errno is often ENOENT as a result of an earlier library call that succeeded
>(but had to test a few places before doing so).

Earlyer on, we find:

stat("/usr/local/share/locale/C/libc.cat", 0xbffff25c) = -1 ENOENT (No such file or directory)

After creating a /usr/local/share/locale with zero permissions, the
message does indeed change:

> dd if=/dev/zero of=/dev/fd0
dd: /dev/fd0: Permission denied
2881+0 records in
2880+0 records out

Alain