GNU bug report logs -
#14897
dd skip exit code
Previous Next
Reported by: ffx <ffx-gdev <at> tfq.fr>
Date: Thu, 18 Jul 2013 12:07:01 UTC
Severity: normal
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 14897 in the body.
You can then email your comments to 14897 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-coreutils <at> gnu.org
:
bug#14897
; Package
coreutils
.
(Thu, 18 Jul 2013 12:07:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
ffx <ffx-gdev <at> tfq.fr>
:
New bug report received and forwarded. Copy sent to
bug-coreutils <at> gnu.org
.
(Thu, 18 Jul 2013 12:07:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Hello
here is a small test I did
bash$ > foo
bash$ dd if=foo skip=10
dd: `foo': cannot skip to specified offset
0+0 records in
0+0 records out
0 bytes (0 B) copied, 0.000167556 s, 0.0 kB/s
bash$ echo $?
0
bash$ dd if=bar skip=10
dd: opening `bar': No such file or directory
bash$ echo $?
1
The test with bar is only to check that exit code can be set.
Is it the expected behaviour to have a success exit code when skip fails, even with the notice message "cannot skip..."?
I would rather expect dd to exit with an error code for the failed skip.
--
ffx
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#14897
; Package
coreutils
.
(Thu, 18 Jul 2013 14:41:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 14897 <at> debbugs.gnu.org (full text, mbox):
On 07/18/2013 02:03 AM, ffx wrote:
> Is it the expected behaviour to have a success exit code when skip fails, even with the notice message "cannot skip..."?
That's the change that was put in a few years ago, yes:
http://git.savannah.gnu.org/cgit/coreutils.git/commit/?id=460ebb078ed7bf249af745d8725d6c37e7f15b57
As the changelog says, POSIX doesn't say what to do in this situation.
Traditional 'dd' (e.g., Solaris 11.1) exits with status 3 (!).
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#14897
; Package
coreutils
.
(Thu, 18 Jul 2013 15:03:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 14897 <at> debbugs.gnu.org (full text, mbox):
On 07/18/2013 03:40 PM, Paul Eggert wrote:
> On 07/18/2013 02:03 AM, ffx wrote:
>> Is it the expected behaviour to have a success exit code when skip fails, even with the notice message "cannot skip..."?
>
> That's the change that was put in a few years ago, yes:
>
> http://git.sv.gnu.org/cgit/coreutils.git/commit/?id=460ebb078
Right that commit added the new warning in this case
> As the changelog says, POSIX doesn't say what to do in this situation.
Right the code portion from the above commit explaining this is:
/* POSIX doesn't say what to do when dd detects it has been
asked to skip past EOF, so I assume it's non-fatal.
There are 3 reasons why there might be unskipped blocks/bytes:
1. file is too small
2. pipe has not enough data
3. short reads */
Hmm I wonder since this is informational, should it be suppressed with status=none
status=none was added recently and I'm leaning towards it
also supressing informational warnings like this?
> Traditional 'dd' (e.g., Solaris 11.1) exits with status 3 (!).
Interesting.
thanks,
Pádraig.
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#14897
; Package
coreutils
.
(Thu, 18 Jul 2013 15:17:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 14897 <at> debbugs.gnu.org (full text, mbox):
On 07/18/2013 05:02 PM, Pádraig Brady wrote:
> /* POSIX doesn't say what to do when dd detects it has been
> asked to skip past EOF, so I assume it's non-fatal.
OTOH, POSIX says:
(http://pubs.opengroup.org/onlinepubs/009695399/utilities/dd.html)
[...] If some other error is detected, a diagnostic message shall
be written and the copy operation shall be discontinued.
Hmm, whatever they mean with "some other error" - couldn't this
be such a seek-on-input failure?
Have a nice day,
Berny
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#14897
; Package
coreutils
.
(Thu, 18 Jul 2013 15:51:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 14897 <at> debbugs.gnu.org (full text, mbox):
On 07/18/13 08:02, Pádraig Brady wrote:
> Hmm I wonder since this is informational, should it be suppressed with status=none
> status=none was added recently and I'm leaning towards it
> also supressing informational warnings like this?
Yes, that makes sense.
It's not an error to seek past EOF, so it shouldn't be an error
and the Solaris behavior is (in my opinion) not that useful.
(At least, for regular files. Not so sure about tapes.)
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#14897
; Package
coreutils
.
(Thu, 18 Jul 2013 15:57:01 GMT)
Full text and
rfc822 format available.
Message #20 received at 14897 <at> debbugs.gnu.org (full text, mbox):
On 07/18/2013 04:16 PM, Bernhard Voelker wrote:
> On 07/18/2013 05:02 PM, Pádraig Brady wrote:
>> /* POSIX doesn't say what to do when dd detects it has been
>> asked to skip past EOF, so I assume it's non-fatal.
>
> OTOH, POSIX says:
> (http://pubs.opengroup.org/onlinepubs/009695399/utilities/dd.html)
>
> [...] If some other error is detected, a diagnostic message shall
> be written and the copy operation shall be discontinued.
>
> Hmm, whatever they mean with "some other error" - couldn't this
> be such a seek-on-input failure?
In the context of the whole section there,
I'm presuming they just mean conv=noerror is
only significant for input errors.
seeking past end of input couldn't be
considered an error IMHO.
thanks,
Pádraig.
Reply sent
to
Pádraig Brady <P <at> draigBrady.com>
:
You have taken responsibility.
(Thu, 18 Jul 2013 17:53:01 GMT)
Full text and
rfc822 format available.
Notification sent
to
ffx <ffx-gdev <at> tfq.fr>
:
bug acknowledged by developer.
(Thu, 18 Jul 2013 17:53:03 GMT)
Full text and
rfc822 format available.
Message #25 received at 14897-done <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On 07/18/2013 04:50 PM, Paul Eggert wrote:
> On 07/18/13 08:02, Pádraig Brady wrote:
>> Hmm I wonder since this is informational, should it be suppressed with status=none
>> status=none was added recently and I'm leaning towards it
>> also supressing informational warnings like this?
>
> Yes, that makes sense.
>
> It's not an error to seek past EOF, so it shouldn't be an error
> and the Solaris behavior is (in my opinion) not that useful.
> (At least, for regular files. Not so sure about tapes.)
The attached patch allows one to set status=none to suppress all diagnostics.
thanks,
Pádraig.
[dd-suppress-warnings.patch (text/x-patch, attachment)]
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#14897
; Package
coreutils
.
(Thu, 18 Jul 2013 18:26:02 GMT)
Full text and
rfc822 format available.
Message #28 received at 14897-done <at> debbugs.gnu.org (full text, mbox):
Thanks.
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#14897
; Package
coreutils
.
(Thu, 18 Jul 2013 21:44:01 GMT)
Full text and
rfc822 format available.
Message #31 received at 14897 <at> debbugs.gnu.org (full text, mbox):
On 07/18/2013 07:52 PM, Pádraig Brady wrote:
> * NEWS: Mention the change in behavior
s/$/./
> @@ -2010,7 +2013,9 @@ dd_copy (void)
>
> if (nread < 0)
> {
> - error (0, errno, _("error reading %s"), quote (input_file));
> + if (!(conversions_mask & C_NOERROR) || !(status_flags & STATUS_NONE))
> + error (0, errno, _("error reading %s"), quote (input_file));
> +
> if (conversions_mask & C_NOERROR)
> {
> print_stats ();
This doesn't look like a non-fatal error to me. Are you sure
we really want to suppress this with status=none?
Reading the Texinfo manual, I think this change in behavior should
also be documented:
Do not print any informational messages to stderr. Error
messages are output as normal.
It probably should say something like "... any informational nor
warning messages ...".
Otherwise +1.
Have a nice day,
Berny
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#14897
; Package
coreutils
.
(Thu, 18 Jul 2013 22:15:02 GMT)
Full text and
rfc822 format available.
Message #34 received at 14897 <at> debbugs.gnu.org (full text, mbox):
On 07/18/2013 10:43 PM, Bernhard Voelker wrote:
>
> On 07/18/2013 07:52 PM, Pádraig Brady wrote:
>
>> * NEWS: Mention the change in behavior
>
> s/$/./
>
>> @@ -2010,7 +2013,9 @@ dd_copy (void)
>>
>> if (nread < 0)
>> {
>> - error (0, errno, _("error reading %s"), quote (input_file));
>> + if (!(conversions_mask & C_NOERROR) || !(status_flags & STATUS_NONE))
>> + error (0, errno, _("error reading %s"), quote (input_file));
>> +
>> if (conversions_mask & C_NOERROR)
>> {
>> print_stats ();
>
> This doesn't look like a non-fatal error to me. Are you sure
> we really want to suppress this with status=none?
I wasn't sure about that one since POSIX says you _shall_ output
a diagnostic in that case. But of course status=none is an extension,
so POSIX doesn't apply so. Also with conv=noerror this is just a warning,
so for consistency it seems right to treat like all other warnings.
> Reading the Texinfo manual, I think this change in behavior should
> also be documented:
>
> Do not print any informational messages to stderr. Error
> messages are output as normal.
>
> It probably should say something like "... any informational nor
> warning messages ...".
I will amend like that and push.
thanks for the review!
Pádraig.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Fri, 16 Aug 2013 11:24:06 GMT)
Full text and
rfc822 format available.
This bug report was last modified 10 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.