GNU bug report logs -
#34347
comm: add 2nd error message after output
Previous Next
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 34347 in the body.
You can then email your comments to 34347 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#34347
; Package
coreutils
.
(Wed, 06 Feb 2019 12:52:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
:
New bug report received and forwarded. Copy sent to
bug-coreutils <at> gnu.org
.
(Wed, 06 Feb 2019 12:52:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
(info "(coreutils) comm invocation")
"Before ‘comm’ can be used, the input files must be sorted"
^^^^
"If an input file is diagnosed as being unsorted, the ‘comm’ command
will exit with a nonzero status (and the output should not be used).
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
"Forcing ‘comm’ to process wrongly sorted input files ... is not
guaranteed to produce any particular output. The output will probably
not correspond with whatever you hoped it would be."
OK, so I would change the default.
The new default should be: before producing even a line of output,
check both files. If either of them is in order, print the error
message, and exit non-zero... _without any line of output!_
Because currently,
$ seq 55 > 5
$ seq 55 |tac > 5r
$ comm 5 5r
just causes the error messages to fly off the screen, leaving only the
savvy user, who checks exit values, to have any inkling that there is a
problem, and he should not order futher warships, airplanes, etc. based
on the results after all.
OR, be so kind as to add a second error message after all the output is
printed, so it won't fly off the screen.
Severity set to 'wishlist' from 'normal'
Request was from
Assaf Gordon <assafgordon <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Fri, 08 Feb 2019 20:34:01 GMT)
Full text and
rfc822 format available.
Changed bug title to 'comm: add 2nd error message after output' from 'At least add 2nd comm error message after output'
Request was from
Assaf Gordon <assafgordon <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Fri, 08 Feb 2019 20:34:02 GMT)
Full text and
rfc822 format available.
Reply sent
to
Pádraig Brady <P <at> draigBrady.com>
:
You have taken responsibility.
(Sat, 09 Feb 2019 19:21:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
:
bug acknowledged by developer.
(Sat, 09 Feb 2019 19:21:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 34347-done <at> debbugs.gnu.org (full text, mbox):
On 06/02/19 04:16, 積丹尼 Dan Jacobson wrote:
> (info "(coreutils) comm invocation")
>
> "Before ‘comm’ can be used, the input files must be sorted"
> ^^^^
> "If an input file is diagnosed as being unsorted, the ‘comm’ command
> will exit with a nonzero status (and the output should not be used).
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> "Forcing ‘comm’ to process wrongly sorted input files ... is not
> guaranteed to produce any particular output. The output will probably
> not correspond with whatever you hoped it would be."
>
> OK, so I would change the default.
>
> The new default should be: before producing even a line of output,
> check both files. If either of them is in order, print the error
> message, and exit non-zero... _without any line of output!_
>
> Because currently,
>
> $ seq 55 > 5
> $ seq 55 |tac > 5r
> $ comm 5 5r
> just causes the error messages to fly off the screen, leaving only the
> savvy user, who checks exit values, to have any inkling that there is a
> problem, and he should not order futher warships, airplanes, etc. based
> on the results after all.
>
> OR, be so kind as to add a second error message after all the output is
> printed, so it won't fly off the screen.
This is a fair point.
Note the --check-order option is stricter and will exit upon the first error message.
join has the same considerations, so this should handle both:
cheers,
Pádraig
diff --git a/src/comm.c b/src/comm.c
index da8d5cf..6f46c98 100644
--- a/src/comm.c
+++ b/src/comm.c
@@ -493,7 +493,7 @@ main (int argc, char **argv)
compare_files (argv + optind);
if (issued_disorder_warning[0] || issued_disorder_warning[1])
- return EXIT_FAILURE;
+ error (EXIT_FAILURE, 0, _("input is not in sorted order"));
else
return EXIT_SUCCESS;
}
diff --git a/src/join.c b/src/join.c
index 7c75c76..e2ba02b 100644
--- a/src/join.c
+++ b/src/join.c
@@ -1193,7 +1193,7 @@ main (int argc, char **argv)
die (EXIT_FAILURE, errno, "%s", quotef (g_names[1]));
if (issued_disorder_warning[0] || issued_disorder_warning[1])
- return EXIT_FAILURE;
+ error (EXIT_FAILURE, 0, _("input is not in sorted order"));
else
return EXIT_SUCCESS;
}
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sun, 10 Mar 2019 11:24:04 GMT)
Full text and
rfc822 format available.
This bug report was last modified 5 years and 49 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.