GNU bug report logs - #15680
dd: suggest iflag=fullblock ... but only if count > 1

Previous Next

Package: coreutils;

Reported by: Bernhard Voelker <mail <at> bernhard-voelker.de>

Date: Tue, 22 Oct 2013 06:49:02 UTC

Severity: normal

Tags: notabug

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 15680 in the body.
You can then email your comments to 15680 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#15680; Package coreutils. (Tue, 22 Oct 2013 06:49:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Bernhard Voelker <mail <at> bernhard-voelker.de>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Tue, 22 Oct 2013 06:49:04 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Bernhard Voelker <mail <at> bernhard-voelker.de>
To: bug-coreutils <at> gnu.org
Subject: dd: suggest iflag=fullblock ... but only if count > 1
Date: Tue, 22 Oct 2013 08:47:50 +0200
dd(1) issues a nice warning about short reads ...

  src/dd if=/dev/random of=sample bs=1000 count=2
  src/dd: warning: partial read (128 bytes); suggest iflag=fullblock
  0+2 records in
  0+2 records out
  256 bytes (256 B) copied, 0.000423371 s, 605 kB/s

... but only if count was > 1:

  src/dd if=/dev/random of=sample bs=1000 count=1
  0+1 records in
  0+1 records out
  128 bytes (128 B) copied, 0.000270231 s, 474 kB/s

Is this by intension or an off-by-one?
I'd like to provide a patch in the latter case.

Have a nice day,
Berny




Information forwarded to bug-coreutils <at> gnu.org:
bug#15680; Package coreutils. (Tue, 22 Oct 2013 07:06:01 GMT) Full text and rfc822 format available.

Message #8 received at 15680 <at> debbugs.gnu.org (full text, mbox):

From: Eric Blake <eblake <at> redhat.com>
To: Bernhard Voelker <mail <at> bernhard-voelker.de>, 15680 <at> debbugs.gnu.org
Subject: Re: bug#15680: dd: suggest iflag=fullblock ... but only if count > 1
Date: Tue, 22 Oct 2013 08:05:12 +0100
[Message part 1 (text/plain, inline)]
On 10/22/2013 07:47 AM, Bernhard Voelker wrote:
> dd(1) issues a nice warning about short reads ...
> 
>   src/dd if=/dev/random of=sample bs=1000 count=2
>   src/dd: warning: partial read (128 bytes); suggest iflag=fullblock
>   0+2 records in
>   0+2 records out
>   256 bytes (256 B) copied, 0.000423371 s, 605 kB/s
> 
> ... but only if count was > 1:
> 
>   src/dd if=/dev/random of=sample bs=1000 count=1
>   0+1 records in
>   0+1 records out
>   128 bytes (128 B) copied, 0.000270231 s, 474 kB/s
> 
> Is this by intension or an off-by-one?

My understanding is that it is intentional.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

[signature.asc (application/pgp-signature, attachment)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#15680; Package coreutils. (Tue, 22 Oct 2013 09:27:02 GMT) Full text and rfc822 format available.

Message #11 received at 15680 <at> debbugs.gnu.org (full text, mbox):

From: Pádraig Brady <P <at> draigBrady.com>
To: Bernhard Voelker <mail <at> bernhard-voelker.de>
Cc: 15680 <at> debbugs.gnu.org
Subject: Re: bug#15680: dd: suggest iflag=fullblock ... but only if count > 1
Date: Tue, 22 Oct 2013 10:25:49 +0100
tag 15680 notabug
close 15680
stop

On 10/22/2013 07:47 AM, Bernhard Voelker wrote:
> dd(1) issues a nice warning about short reads ...
> 
>   src/dd if=/dev/random of=sample bs=1000 count=2
>   src/dd: warning: partial read (128 bytes); suggest iflag=fullblock
>   0+2 records in
>   0+2 records out
>   256 bytes (256 B) copied, 0.000423371 s, 605 kB/s
> 
> ... but only if count was > 1:
> 
>   src/dd if=/dev/random of=sample bs=1000 count=1
>   0+1 records in
>   0+1 records out
>   128 bytes (128 B) copied, 0.000270231 s, 474 kB/s
> 
> Is this by intension or an off-by-one?
> I'd like to provide a patch in the latter case.

The various cases for warning were disucussed at:
http://bugs.gnu.org/7362

Also I mentioned this particular case with count at:
http://bugs.gnu.org/9734#18

Copying from there...

"Note the particular case where count=1 is not warned about,
as with a single read, one doesn't know if we're just at EOF.
Also it's probably a quite common idiom to, consume available data
up to $bs bytes."

thanks,
Pádraig.




Added tag(s) notabug. Request was from Pádraig Brady <P <at> draigBrady.com> to control <at> debbugs.gnu.org. (Tue, 22 Oct 2013 09:27:03 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 15680 <at> debbugs.gnu.org and Bernhard Voelker <mail <at> bernhard-voelker.de> Request was from Pádraig Brady <P <at> draigBrady.com> to control <at> debbugs.gnu.org. (Tue, 22 Oct 2013 09:27:04 GMT) Full text and rfc822 format available.

Information forwarded to bug-coreutils <at> gnu.org:
bug#15680; Package coreutils. (Tue, 22 Oct 2013 10:27:02 GMT) Full text and rfc822 format available.

Message #18 received at 15680 <at> debbugs.gnu.org (full text, mbox):

From: Bernhard Voelker <mail <at> bernhard-voelker.de>
To: Pádraig Brady <P <at> draigBrady.com>
Cc: 15680 <at> debbugs.gnu.org
Subject: Re: bug#15680: dd: suggest iflag=fullblock ... but only if count > 1
Date: Tue, 22 Oct 2013 12:26:28 +0200 (CEST)
> On October 22, 2013 at 11:25 AM Pádraig Brady <P <at> draigBrady.com> wrote:
> Also I mentioned this particular case with count at:
> http://bugs.gnu.org/9734#18
> 
> Copying from there...
> 
> "Note the particular case where count=1 is not warned about,
> as with a single read, one doesn't know if we're just at EOF.
> Also it's probably a quite common idiom to, consume available data
> up to $bs bytes."

Thanks.
To avoid that this question comes up again: should we add
this into the Texinfo file?

Have a nice day,
Berny




Information forwarded to bug-coreutils <at> gnu.org:
bug#15680; Package coreutils. (Tue, 22 Oct 2013 11:04:02 GMT) Full text and rfc822 format available.

Message #21 received at 15680 <at> debbugs.gnu.org (full text, mbox):

From: Pádraig Brady <P <at> draigBrady.com>
To: Bernhard Voelker <mail <at> bernhard-voelker.de>
Cc: 15680 <at> debbugs.gnu.org
Subject: Re: bug#15680: dd: suggest iflag=fullblock ... but only if count > 1
Date: Tue, 22 Oct 2013 12:03:10 +0100
On 10/22/2013 11:26 AM, Bernhard Voelker wrote:
>>  On October 22, 2013 at 11:25 AM Pádraig Brady <P <at> draigBrady.com> wrote:
>>  Also I mentioned this particular case with count at:
>>  http://bugs.gnu.org/9734#18
>>  
>>  Copying from there...
>>  
>>  "Note the particular case where count=1 is not warned about,
>>  as with a single read, one doesn't know if we're just at EOF.
>>  Also it's probably a quite common idiom to, consume available data
>>  up to $bs bytes."
> 
> Thanks.
> To avoid that this question comes up again: should we add
> this into the Texinfo file?

Maybe, though we have to be careful of coupling the
docs too tightly with the code.
Worth a source comment at least.





Information forwarded to bug-coreutils <at> gnu.org:
bug#15680; Package coreutils. (Tue, 22 Oct 2013 13:15:03 GMT) Full text and rfc822 format available.

Message #24 received at 15680 <at> debbugs.gnu.org (full text, mbox):

From: Bernhard Voelker <mail <at> bernhard-voelker.de>
To: Pádraig Brady <P <at> draigBrady.com>
Cc: 15680 <at> debbugs.gnu.org
Subject: Re: bug#15680: dd: suggest iflag=fullblock ... but only if count > 1
Date: Tue, 22 Oct 2013 15:14:17 +0200 (CEST)
> On October 22, 2013 at 1:03 PM Pádraig Brady <P <at> draigBrady.com> wrote:
> On 10/22/2013 11:26 AM, Bernhard Voelker wrote:
> > To avoid that this question comes up again: should we add
> > this into the Texinfo file?
> 
> Maybe, though we have to be careful of coupling the
> docs too tightly with the code.
> Worth a source comment at least.

Ctually, this question came up on a discussion on the
opensuse-factory mailing list [1].
It'd be good to be able to point end users to some documentation
they can easily access.  Therefore, I thought that the info
pages would be the right place.
WDYT?

[1] http://lists.opensuse.org/opensuse-factory/2013-10/msg00565.html

Have a nice day,
Berny




Information forwarded to bug-coreutils <at> gnu.org:
bug#15680; Package coreutils. (Tue, 22 Oct 2013 15:30:02 GMT) Full text and rfc822 format available.

Message #27 received at 15680 <at> debbugs.gnu.org (full text, mbox):

From: Pádraig Brady <P <at> draigBrady.com>
To: Bernhard Voelker <mail <at> bernhard-voelker.de>
Cc: 15680 <at> debbugs.gnu.org
Subject: Re: bug#15680: dd: suggest iflag=fullblock ... but only if count > 1
Date: Tue, 22 Oct 2013 16:29:44 +0100
On 10/22/2013 02:14 PM, Bernhard Voelker wrote:
>>  On October 22, 2013 at 1:03 PM Pádraig Brady <P <at> draigBrady.com> wrote:
>>  On 10/22/2013 11:26 AM, Bernhard Voelker wrote:
>>  > To avoid that this question comes up again: should we add
>>  > this into the Texinfo file?
>>  
>>  Maybe, though we have to be careful of coupling the
>>  docs too tightly with the code.
>>  Worth a source comment at least.
> 
> Ctually, this question came up on a discussion on the
> opensuse-factory mailing list [1].
> It'd be good to be able to point end users to some documentation
> they can easily access.  Therefore, I thought that the info
> pages would be the right place.
> WDYT?
> 
> [1] http://lists.opensuse.org/opensuse-factory/2013-10/msg00565.html

That thread could just link to:
http://www.gnu.org/software/coreutils/manual/html_node/dd-invocation.html
and the count= description which references iflag=fullblock,
should explain the short read situation adequately I think?

The runtime warning conditions were chosen to be conservative,
and only trigger when a short read is confirmed to have occurred,
in a probably unintended situation, rather than flagging potential
issues with different inputs files etc.

Now we might add various extra up front messages about potential
gotchas in dd usage when conv=debug was specified (akin to sort --debug).
Given that I have trouble remembering the edge cases sometimes
(like I did for sort), it might be worth adding.

thanks,
Pádraig.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 20 Nov 2013 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 272 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.