[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: dd: add 'skip_bytes' and 'count_bytes' operands
From: |
Pádraig Brady |
Subject: |
Re: dd: add 'skip_bytes' and 'count_bytes' operands |
Date: |
Mon, 13 Feb 2012 13:09:37 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:6.0) Gecko/20110816 Thunderbird/6.0 |
On 02/13/2012 10:13 AM, Bernhard Voelker wrote:
>
>
> On 02/13/2012 11:00 AM, Pádraig Brady wrote:
>> On 02/13/2012 07:50 AM, Bernhard Voelker wrote:
>>> On 02/10/2012 05:21 PM, Jérémy Compostella wrote:
>>>
>>> Sorry, this is a bit late, but I have 2 notes about the
>>> new dd/bytes test:
>>>
>>>> diff --git a/tests/dd/bytes b/tests/dd/bytes
>>>> new file mode 100755
>>>> index 0000000..6038742
>>>> --- /dev/null
>>>> +++ b/tests/dd/bytes
>>>> @@ -0,0 +1,57 @@
>>>
>>>> +# seek bytes
>>>> +echo abcdefghijklm |
>>>> + dd bs=5 seek=8 oflag=seek_bytes > out 2> /dev/null || fail=1
>>>> +echo abcdefghijklm |
>>>> + dd bs=4 seek=2 > expected 2> /dev/null || fail=1
>>>> +compare expected out || fail=1
>>>
>>> I don't know why, but I somehow do not have a good feeling
>>> about a test comparing the result of the program to be tested
>>> with another run. If something cowardly fails, then this test
>>> would succeed.
>>
>> Fair point.
>
> Thanks for the patch.
>
>>>> +# seek bytes on empty file
>>>> +echo abcdefghijklm |
>>>> + dd bs=5 seek=8 oflag=seek_bytes > out2 2> /dev/null || fail=1
>>>> +compare expected out2 || fail=1
>>>
>>> The comment is wrong here, isn't it?
>>
>> Well out2 will be a new empty file.
>> Though the case is no different to the previous
>> (since conv=notrunc was not specified).
>> So I'll just remove it.
>
> Ah, I see. Thanks for the clarification.
>
> BTW: shouldn't
> echo abcdefghijklm | src/dd bs=5 seek=8 oflag=seek_bytes
> receive EPIPE? When run on a terminal, dd waits in read() forever.
True. That's because we try to seek using read()
on non seekable files, and stdout is readable by default,
so we'll hang waiting for input from the terminal.
I.E. this will block:
dd seek=1 if=/dev/null
Not sure what to do there.
cheers,
Pádraig.
- RE: dd: add 'skip_bytes' and 'count_bytes' operands, (continued)
- RE: dd: add 'skip_bytes' and 'count_bytes' operands, Voelker, Bernhard, 2012/02/09
- Re: dd: add 'skip_bytes' and 'count_bytes' operands, Pádraig Brady, 2012/02/08
- Re: dd: add 'skip_bytes' and 'count_bytes' operands, Jérémy Compostella, 2012/02/08
- Re: dd: add 'skip_bytes' and 'count_bytes' operands, Jérémy Compostella, 2012/02/10
- Re: dd: add 'skip_bytes' and 'count_bytes' operands, Pádraig Brady, 2012/02/10
- Re: dd: add 'skip_bytes' and 'count_bytes' operands, Pádraig Brady, 2012/02/11
- Re: dd: add 'skip_bytes' and 'count_bytes' operands, Pádraig Brady, 2012/02/13
- Re: dd: add 'skip_bytes' and 'count_bytes' operands, Bernhard Voelker, 2012/02/13
- Re: dd: add 'skip_bytes' and 'count_bytes' operands, Pádraig Brady, 2012/02/13
- Re: dd: add 'skip_bytes' and 'count_bytes' operands, Bernhard Voelker, 2012/02/13
- Re: dd: add 'skip_bytes' and 'count_bytes' operands,
Pádraig Brady <=
- Re: dd: add 'skip_bytes' and 'count_bytes' operands, Bernhard Voelker, 2012/02/13
- Re: dd: add 'skip_bytes' and 'count_bytes' operands, Pádraig Brady, 2012/02/13
- Re: dd: add 'skip_bytes' and 'count_bytes' operands, Bernhard Voelker, 2012/02/13
- Re: dd: add 'skip_bytes' and 'count_bytes' operands, Bernhard Voelker, 2012/02/13
- Re: dd: add 'skip_bytes' and 'count_bytes' operands, Jérémy Compostella, 2012/02/13
- Re: dd: add 'skip_bytes' and 'count_bytes' operands, Pádraig Brady, 2012/02/13