Re: 2.4.0-test10 truncate() change broke `dd'

From: Alexander Viro (viro@math.psu.edu)
Date: Thu Nov 16 2000 - 03:02:31 EST


On Thu, 16 Nov 2000, Mikael Pettersson wrote:

> I noticed because I needed to build a boot floppy with an
> initial ram disk under 2.4.0-test11pre5. The standard recipe
> (Documentation/ramdisk.txt) basically goes:
> - dd if=bzImage of=/dev/fd0 bs=1k
> notice how many blocks dd reported (NNN)
> - dd if=ram_image of=/dev/fd0 bs=1k seek=NNN
> dd implements the seek=NNN option by calling ftruncate() before
> starting the write. This is where 2.4.0-test10 breaks, since
> ftruncate on a block device now provokes an EACCES error.

And what kind of meaning would you assign to truncate on floppy?
 
> Maybe `dd' is buggy and should use lseek() instead, but this has
> apparently worked for a long time.

Use conv=notrunc.

> Does anyone know the reason for the S_ISDIR -> !S_ISREG change in test10?

For one thing, you really don't want it working on pipes. For another -
it's just damn meaningless on devices, symlinks and sockets. Which leaves
regular files.

OTOH, -EACCES looks wrong - for directories we must return -EISDIR and for
sockets ftruncate() should return -EINVAL. Adopting -EINVAL for devices
and pipes may be a good idea... Andries, could you comment on that?

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Nov 23 2000 - 21:00:09 EST