Re: 1.3.6[0-7] floppy driver broken

Mike Black (mblack@csihq.com)
Sat, 24 Feb 1996 08:11:07 -0500


At 02:57 PM 2/23/96 +0200, Linus Torvalds wrote:
>> 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.
>

Excellent! I checked it out and indeed the prob is with "dd". The final
write returns 0 and it assumes it's an error. Silly me, I should know
better than to assume a utility is written correctly...:-(
-
/----------------------------------------------------------\
| Mike Black mblack@csihq.com 407-676-5118, x203 |
| Computer Science Innovations, Inc. 407-676-2355 FAX |
| Melbourne FL 32904-2314 http://www.csihq.com |
\----------------------------------------------------------/