GNU bug report logs - #34923
dd: add messages about IO errors

Previous Next

Package: coreutils;

Reported by: "Daniel A. Gauthier" <fractal2010 <at> fractals.net>

Date: Wed, 20 Mar 2019 01:55:02 UTC

Severity: wishlist

Tags: notabug

To reply to this bug, email your comments to 34923 AT debbugs.gnu.org.

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#34923; Package coreutils. (Wed, 20 Mar 2019 01:55:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Daniel A. Gauthier" <fractal2010 <at> fractals.net>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Wed, 20 Mar 2019 01:55:02 GMT) Full text and rfc822 format available.

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

From: "Daniel A. Gauthier" <fractal2010 <at> fractals.net>
To: bug-coreutils <at> gnu.org
Subject: Message/race bug in 'dd'
Date: Tue, 19 Mar 2019 20:41:44 -0400
Coreutils / DD / stderr output warning / Timing or count error:

I may or may not have reported this bug many years (decade?) ago and just
noticed it's still there.

Correct example.

dd
<data>
^D
0+1 records in
0+1 records out
Other timing/byte counts, kb/s, etc., in this case 7 bytes (the
"<data>" is literal) - the +1 is due to short block.

This works fine as long as you aren't using "conv=sync,noerror".

If you are, however, then do a:

dd conv=sync,noerror if=file-with-bad-spots.dat
of=newfile-without-,-hopefully.dat
(sometime after...)
0+0 records in
0+0 records out
dd: read error on file-with-bad-spots.dat
Usual other timing/byte counts, etc. are correct (AFAIK)
(-- a few minutes goes by ... --)
0+1 records in
0+0 records out
dd: read error (again, yadayadayada)
(many more minutes...)
0+2 records in
0+0 records out
Timing, counts, etc.
Total bytes per the file copied, etc. all appear to be correct and the
"+nn+ is the number of bad spots.

NOTICE that the "+nn" value on the line is always one off.  It says +0
after the first error, +1 after the second, etc. until the correct count
of error/short blocks is given at the end.  My utility program monitors
the output of dd's stderr and prints a colored warning message whenever
the "+nn" count goes up, but it doesn't go up right away.  Even
worse, if you are using USR1 to signal on a regular schedule, as I do,
the error is indicated to the program long after the error actually
occurred and the included byte count does NOT point to the bad spot. 
(The subsequent USR1 signals indicate the current error count, but the
one that was printed WITH the error message does not)

I hope there's no historical reason for this, I might be able to test
other versions to see if it's there also.  It just seems to me that
from a design perspective, I see a number of reasons why the text
printed to stderr at the time the error is encountered should be
consistent and reflective of the error that caused it to be printed, and
I have no reason why the phase of the number stream versus the input
stream should matter to anything else.  Combine that with the fact that
it appears it should be an easy change and I'm hoping someone familiar
with the code could kick out a patch in 3 or 4 minutes that'd take me
much longer having no familiarity with the code.  (But if I ever get
free time I might take a look).

The obvious assumption is that a "++err_count" line needs to be moved
up 1 or 2 lines.

I've had various accounts on tracking systems over the years, but my
attention span is really short.

Daniel A. Gauthier
aka Fractal







Information forwarded to bug-coreutils <at> gnu.org:
bug#34923; Package coreutils. (Wed, 20 Mar 2019 03:45:01 GMT) Full text and rfc822 format available.

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

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: "Daniel A. Gauthier" <fractal2010 <at> fractals.net>, 34923 <at> debbugs.gnu.org
Subject: Re: bug#34923: Message/race bug in 'dd'
Date: Tue, 19 Mar 2019 20:44:42 -0700
[Message part 1 (text/plain, inline)]
Daniel A. Gauthier wrote:
> NOTICE that the "+nn" value on the line is always one off.  It says +0
> after the first error, +1 after the second, etc. until the correct count
> of error/short blocks is given at the end.

The count is supposed to just count short blocks, not errors. This is a POSIX 
requirement. I installed the attached documentation patch to try to make this 
clearer.

Perhaps dd should output a separate line to stderr that summaries I/O errors; it 
could do that without violating POSIX.
[0001-dd-improve-doc-of-stderr-output.patch (text/x-patch, attachment)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#34923; Package coreutils. (Thu, 28 Mar 2019 17:58:01 GMT) Full text and rfc822 format available.

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

From: Assaf Gordon <assafgordon <at> gmail.com>
To: Paul Eggert <eggert <at> cs.ucla.edu>,
 "Daniel A. Gauthier" <fractal2010 <at> fractals.net>, 34923 <at> debbugs.gnu.org
Subject: Re: bug#34923: Message/race bug in 'dd'
Date: Thu, 28 Mar 2019 11:57:04 -0600
tags 34923 notabug
severity 34923 wishlist
retitle 34923 dd: add messages about IO errors
stop

On 2019-03-19 9:44 p.m., Paul Eggert wrote:
> Daniel A. Gauthier wrote:
>> NOTICE that the "+nn" value on the line is always one off.  It says +0
>> after the first error, +1 after the second, etc. until the correct count
>> of error/short blocks is given at the end.
> 
> The count is supposed to just count short blocks, not errors. This is a 
> POSIX requirement. I installed the attached documentation patch to try 
> to make this clearer.

The documentation improvement was added here:
https://git.savannah.gnu.org/cgit/coreutils.git/commit/?id=59e01d13e600be0d2c7f08f3aff8cf11936b3ea1


> Perhaps dd should output a separate line to stderr that summaries I/O 
> errors; it could do that without violating POSIX.

Marking this as a wishlist item.

-assaf






Added tag(s) notabug. Request was from Assaf Gordon <assafgordon <at> gmail.com> to control <at> debbugs.gnu.org. (Thu, 28 Mar 2019 17:58:02 GMT) Full text and rfc822 format available.

Severity set to 'wishlist' from 'normal' Request was from Assaf Gordon <assafgordon <at> gmail.com> to control <at> debbugs.gnu.org. (Thu, 28 Mar 2019 17:58:02 GMT) Full text and rfc822 format available.

Changed bug title to 'dd: add messages about IO errors' from 'Message/race bug in 'dd'' Request was from Assaf Gordon <assafgordon <at> gmail.com> to control <at> debbugs.gnu.org. (Thu, 28 Mar 2019 17:58:02 GMT) Full text and rfc822 format available.

This bug report was last modified 6 years and 143 days ago.

Previous Next


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