bug-coreutils
[Top][All Lists]
Advanced

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

Re: dd skip bug?


From: Jim Meyering
Subject: Re: dd skip bug?
Date: Tue, 27 Jan 2009 11:50:32 +0100

Pádraig Brady <address@hidden> wrote:
...
> I changed message as shown below.
> But in further testing before commiting I noticed an inconsistency
> with my fix for this case, specifically when dealing with blocksizes > 1.
>
> For seekable files I count a partial block as an unread record,
> thus printing the diagnostic. This is not the case for pipes though
> as demonstrated here:

Good catch.

> $ truncate -s3 pb.size
>
> $ dd iflag=fullblock bs=2 skip=2 if=pb.size
> ./dd: `pb.size': skip offset was past end of input file: Invalid argument
>
> $ cat pb.size | ./dd iflag=fullblock bs=2 skip=2
>
> $ cat pb.size | ./dd iflag=fullblock bs=1 skip=4
> ./dd: `standard input': skip offset was past end of input file: Invalid 
> argument
>
> So should the first dd command not print the message,
> or should the second dd command print the message?

Whatever you prefer, as long as it's consistent.

> I leaning towards changing skip() for seekable files
> to return the number of _full_ records unskipped
> to keep it the same as for pipes.
> Then printing the warning for all cases where
> the input offset != skip*bs ?

But remember that the initial offset for a seekable file
need not be zero.  I.e., this should now evoke a warning:

  printf 1234 > k && (dd bs=1 skip=2 count=0 && dd bs=1 skip=3) < k




reply via email to

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