[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: possible bug - output stream handling inconsistency in dd
From: |
Paul Eggert |
Subject: |
Re: possible bug - output stream handling inconsistency in dd |
Date: |
Tue, 01 Nov 2005 16:08:51 -0800 |
User-agent: |
Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) |
"Theodoros V. Kalamatianos" <address@hidden> writes:
> lseek is valid on e.g. /dev/hda and people
> would not expect dd to null their data till it reached the desired
> offset.
True. I guess the algorithm should be to use lseek if possible, and
to write nulls otherwise. Then ftruncate if possible.
> Perhaps dd should output null bytes only on FIFOs ?
I'd say it should output nulls if lseek fails for any reason.
> On a relative matter, what should dd do in the following case:
>
> $ echo -n AB > f
> $ echo -n ab | dd bs=1 seek=1 >> f
>
> What should the contents of `f' be ?
Just "ABab". That's a tricky one, since the ">>f" means that stdout
is in append mode, which means all writes are appended to the end of
the file regardless of the current seek position. So the "seek=1" is
ineffective.