bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: dd skip= misbehavior


From: Dmitry V. Levin
Subject: Re: dd skip= misbehavior
Date: Tue, 28 Mar 2006 04:32:04 +0400

On Mon, Mar 27, 2006 at 05:33:48AM +0400, Solar Designer wrote:
[...]
> POSIX.1-2001 does not appear to explicitly specify the behavior of
> skip= with partial reads.  It defines skip= as follows:
> 
>      skip=n
>              Skip n input blocks (using the specified input block size)
>              before starting to copy. On seekable files, the implementation
>              shall read the blocks or seek past them; on non-seekable files,
>              the blocks shall be read and the data shall be discarded.
> 
> However, it gives this example:
> 
>      The following command:
> 
>  dd ibs=10 skip=1
> 
>      strips the first 10 bytes from standard input.
> 
> Notice that they said "the first 10 bytes", with no exceptions - does
> this mean that this command should skip the first 10 bytes even if the
> first read() returns only 5 bytes?

Here is a simple test case to illustrate the issue:

$ echo 123456789 |dd ibs=10 skip=1
0+0 records in
0+0 records out
0 bytes (0 B) copied, 2e-05 seconds, 0 B/s

$ (echo -n 12345; /bin/true; echo 6789) |dd ibs=10 skip=1
6789
0+1 records in
0+1 records out
5 bytes (5 B) copied, 0.000253 seconds, 19.8 kB/s


-- 
ldv

Attachment: pgpF36zYgMx03.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]