bug-coreutils
[Top][All Lists]
Advanced

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

Re: dd skip bug?


From: Brock Noland
Subject: Re: dd skip bug?
Date: Wed, 16 Apr 2008 23:30:11 -0500

On Wed, Apr 16, 2008 at 7:01 PM, Pádraig Brady <address@hidden> wrote:
> dd handles skip weirdly
>
>  disk=/dev/sda8
>  dd if=$disk bs=8M count=1 skip=1000 of=/dev/null  #ok
>  dd if=$disk bs=8M count=1 skip=1000K of=/dev/null #reads whole disk! as seek 
> fails
>
>  I had a 10s look at the source and noticed a comment
>  saying POSIX doesn't specify what we should do when
>  skipping past the end of input. For seekable files though,
>  reading the whole thing is unexpected to me at least.
>  I would expect it to do:
>
>  if (seekable && !seek(skip_len))
>     exit(EXIT_FAILURE);

It looks me that the offset is too large? strace shows:
_llseek(0, 8589934592000, 0xbff7efb0, SEEK_CUR) = -1 EINVAL (Invalid argument)

Where as strace dd if=/dev/hda2 of=/dev/null bs=8M skip=10 shows:
_llseek(0, 83886080, [83886080], SEEK_CUR) = 0

I agree that I would expect if the file is seekable and seek fails, dd
would exit. But here it looks like we just cannot seek that large of
an offset?

Respectfully,
Brock




reply via email to

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