Re: dd: add 'skip_bytes' and 'count_bytes' operands
From:
Bernhard Voelker
Subject:
Re: dd: add 'skip_bytes' and 'count_bytes' operands
Date:
Mon, 13 Feb 2012 16:53:06 +0100
User-agent:
Mozilla/5.0 (X11; Linux x86_64; rv:10.0) Gecko/20120129 Thunderbird/10.0
On 02/13/2012 04:06 PM, Bernhard Voelker wrote:
> Now, I see it: it's reading from *stdout*, not from stdin:
>
> lseek(1, 0, SEEK_END) = -1 ESPIPE (Illegal seek)
> read(1, 0x616000, 512) = ?
>
> It could issue an error if "seek=..." is used when fdesc is a tty.
Interestingly, read returns with EBADF if stdout is
redirected to /dev/tty:
/usr/bin/printf "abc" | strace src/dd seek=1 > /dev/tty
...
lseek(1, 0, SEEK_END) = -1 ESPIPE (Illegal seek)
read(1, 0x616000, 512) = -1 EBADF (Bad file descriptor)
but it blocks again when of=/dev/tty is given:
/usr/bin/printf "abc" | strace src/dd seek=1 of=/dev/tty
I'm getting the impression that this is a kernel problem.
Have a nice day,
Berny