dd/bytes
Writing this patch I thought it would be nice having the seek_bytes
operand too. What is your opinion about this ?
Cheers,
Jérémy
>From 732f14abfc8b1b5aa711a41cc4dd7fdc0b3d045a Mon Sep 17 00:00:00 2001
From: Jeremy Compostella
Date: Sat, 4 Feb 2012 15:25:54 +0100
Subject: [PATCH] d
00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Compostella?=
Date: Sat, 4 Feb 2012 15:25:54 +0100
Subject: [PATCH] dd: add skip_bytes and count_bytes operands
dd now accepts:
- the skip_bytes=N operand: When specified, dd skip N bytes before
copying. 'skip' and 'skip_bytes"
On 02/06/2012 02:01 PM, Jérémy Compostella wrote:
> Pádraig, all,
>
> I took into account general comments on my commits. I attached the
> improved patch for feature. Improvements are:
> - Add by file description,
> - I put back accents on my name (Jérémy instead of Jeremy),
Great thanks.
Hmm, s
> Hmm, shouldn't there be a seek_bytes param too for consistency?
That was effectively my first mail question. As you talk about it in
your explanation addition in coreutils.texi I guess I should start
implementing it ?
> I'd change the NEWS to something simpler like:
> ** New features
> dd now a
On 02/06/2012 03:24 PM, Jérémy Compostella wrote:
>> Hmm, shouldn't there be a seek_bytes param too for consistency?
> That was effectively my first mail question. As you talk about it in
> your explanation addition in coreutils.texi I guess I should start
> implementing it ?
I think so.
Note it
> On 02/06/2012 03:24 PM, Jérémy Compostella wrote:
> >> Hmm, shouldn't there be a seek_bytes param too for consistency?
> > That was effectively my first mail question. As you talk about it in
> > your explanation addition in coreutils.texi I guess I should start
> > implementing it ?
>
> I think
On 02/07/2012 06:25 PM, Jérémy Compostella wrote:
>> On 02/06/2012 03:24 PM, Jérémy Compostella wrote:
>> >> Hmm, shouldn't there be a seek_bytes param too for consistency?
>> > That was effectively my first mail question. As you talk about it in
>> > your explanation addition in coreutils.texi I g
> That leads onto the only other possible implementation I suppose.
> I.E. since we don't need to specify skip and skip_bytes together,
> the option value could select between each mode. I.E.
>
> skip=2 => skip2 blocks,
> skip=2b => skip 1024 blocks,
> skip=2bytes => skip2 bytes
>
[...]
> > Hmm, that's not too bad at all really
> I do agree, it looks like a very interesting idea indeed. However, I
> have two questions:
> 1. Why skip=2b => 1024 blocks ?
> 2. Do you know if there is a utility function somewhere in coreutils or
> gnulib which could help me to parse this ? If su
On 02/08/2012 08:14 AM, Jérémy Compostella wrote:
>> That leads onto the only other possible implementation I suppose.
>> I.E. since we don't need to specify skip and skip_bytes together,
>> the option value could select between each mode. I.E.
>>
>> skip=2 => skip2 blocks,
>> skip=2b
On 02/08/2012 03:14 PM, Jérémy Compostella wrote:
>> That leads onto the only other possible implementation I suppose.
>> I.E. since we don't need to specify skip and skip_bytes together,
>> the option value could select between each mode. I.E.
>>
>> skip=2 => skip2 blocks,
>> skip=2b
First, thank you Eric for the explanation and the guidance.
[...]
> On 02/08/2012 03:14 PM, Jérémy Compostella wrote:
> Not too bad. A variation to tagging the number directly, would be to
> add flags:
>
> iflag=skip_bytes # Treat skip as number of bytes not blocks
> iflag=count_bytes # Treat c
Hi,
On Wed, Feb 08, 2012 at 09:05:43AM -0700, Eric Blake wrote:
> On 02/08/2012 08:14 AM, Jérémy Compostella wrote:
> >> That leads onto the only other possible implementation I suppose.
> >> I.E. since we don't need to specify skip and skip_bytes together,
> >> the option value could select betwe
Eric Blake wrote:
> Because POSIX requires that one.
> http://pubs.opengroup.org/onlinepubs/9699919799/utilities/dd.html
>
> For the bs=, cbs=, ibs=, and obs= operands, the application shall supply
> an expression specifying a size in bytes. The expression, expr, can be:
...
> Two or more posi
Pádraig, others,
First, I added the missing seek_bytes feature.
Second, I re-wrote the patch in order to replace the _bytes operands by the
corresponding input/output flags.
Finally, I added some tests to check the new seek_bytes flag.
I successfully run the entire tests suite.
I attached the ne
On 02/10/2012 04:21 PM, Jérémy Compostella wrote:
> Pádraig, others,
>
> First, I added the missing seek_bytes feature.
> Second, I re-wrote the patch in order to replace the _bytes operands by the
> corresponding input/output flags.
> Finally, I added some tests to check the new seek_bytes flag.
On 02/10/2012 04:57 PM, Pádraig Brady wrote:
> On 02/10/2012 04:21 PM, Jérémy Compostella wrote:
>> Pádraig, others,
>>
>> First, I added the missing seek_bytes feature.
>> Second, I re-wrote the patch in order to replace the _bytes operands by the
>> corresponding input/output flags.
>> Finally, I
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 000..6038742
> --- /dev/null
> +++ b/tests/dd/bytes
> @@ -0,0 +1,57 @@
> +# seek bytes
>
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 000..6038742
>> --- /dev/null
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
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:
>>>
>>
I've just noticed a couple of edge case issues.
The first hunk is for when not doing I/O,
ftruncate() should be on the full size.
The second, will not invalidate cache for the whole file,
if 0 < count < ibs
cheers,
Pádraig.
--- a/src/dd.c
+++ b/src/dd.c
@@ -2170,7 +2170,7 @@ main (int argc, cha
On 02/13/2012 02:09 PM, Pádraig Brady wrote:
>> 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 readabl
On 02/13/2012 02:28 PM, Bernhard Voelker wrote:
>
>
> On 02/13/2012 02:09 PM, Pádraig Brady wrote:
>>> 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 usi
On 02/13/2012 03:31 PM, Pádraig Brady wrote:
> On 02/13/2012 02:28 PM, Bernhard Voelker wrote:
>>
>>
>> On 02/13/2012 02:09 PM, Pádraig Brady wrote:
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()
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.
Pádraig,
I took a closer look to the last test case. I wrote it during the
development phase. At this time, I forced the skip() function to failed
in order to test the line 1896 algorithm.
I just made some test and was unable to make the lseek() call failed on
my system. So I guess we could remov
On 02/13/2012 06:41 PM, Jérémy Compostella wrote:
> Pádraig,
>
> I took a closer look to the last test case. I wrote it during the
> development phase. At this time, I forced the skip() function to failed
> in order to test the line 1896 algorithm.
>
> I just made some test and was unable to make
28 matches
Mail list logo