]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
comm,join: ensure warnings are apparent upon exit
authorPádraig Brady <P@draigBrady.com>
Mon, 11 Feb 2019 01:40:36 +0000 (17:40 -0800)
committerPádraig Brady <P@draigBrady.com>
Tue, 12 Feb 2019 06:56:21 +0000 (22:56 -0800)
* src/comm.c (main): Output a warning right before exit,
in case previous errors have scrolled from view.
* src/join.c (main): Likewise.
* tests/misc/comm.pl: Addjust accordingly.
* tests/misc/join.pl: Likewise.
Fixes https://bugs.gnu.org/34347

src/comm.c
src/join.c
tests/misc/comm.pl
tests/misc/join.pl

index da8d5cfa81542f8e4618651390c229c2741cc4b5..3e8cf186515aaba0f5bb79a54fdd6043a1e9d680 100644 (file)
@@ -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;
+    die (EXIT_FAILURE, 0, _("input is not in sorted order"));
   else
     return EXIT_SUCCESS;
 }
index 7c75c76b900c88072c4516ecfd09e91f4387f7bd..dd0ce42bcdfbebe4d89f412ec284bf2493d5ec7e 100644 (file)
@@ -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;
+    die (EXIT_FAILURE, 0, _("input is not in sorted order"));
   else
     return EXIT_SUCCESS;
 }
index 2e87f8080c0449fc94a99a17c55c37a9d6dd120a..61857f37305a33e1b9174d26e7024a08a52b8f7d 100755 (executable)
@@ -89,7 +89,8 @@ my @Tests =
    # out-of-order input
    ['ooo', {IN=>{a=>"1\n3"}}, {IN=>{b=>"3\n2"}}, {EXIT=>1},
     {OUT => "1\n\t\t3\n\t2\n"},
-    {ERR => "$prog: file 2 is not in sorted order\n"}],
+    {ERR => "$prog: file 2 is not in sorted order\n"
+          . "$prog: input is not in sorted order\n"}],
 
    # out-of-order input, fatal
    ['ooo2', '--check-order', {IN=>{a=>"1\n3"}}, {IN=>{b=>"3\n2"}}, {EXIT=>1},
@@ -104,23 +105,27 @@ my @Tests =
    ['ooo4', {IN=>{a=>"3\n1\n0"}}, {IN=>{b=>"3\n2\n0"}}, {EXIT=>1},
     {OUT => "\t\t3\n1\n0\n\t2\n\t0\n"},
     {ERR => "$prog: file 1 is not in sorted order\n".
-            "$prog: file 2 is not in sorted order\n" }],
+            "$prog: file 2 is not in sorted order\n"
+          . "$prog: input is not in sorted order\n"}],
 
    # both inputs out-of-order on last pair
    ['ooo5', {IN=>{a=>"3\n1"}}, {IN=>{b=>"3\n2"}}, {EXIT=>1},
     {OUT => "\t\t3\n1\n\t2\n"},
     {ERR => "$prog: file 1 is not in sorted order\n".
-            "$prog: file 2 is not in sorted order\n" }],
+            "$prog: file 2 is not in sorted order\n"
+          . "$prog: input is not in sorted order\n"}],
 
    # first input out-of-order extended
    ['ooo5b', {IN=>{a=>"0\n3\n1"}}, {IN=>{b=>"2\n3"}}, {EXIT=>1},
     {OUT => "0\n\t2\n\t\t3\n1\n"},
-    {ERR => "$prog: file 1 is not in sorted order\n"}],
+    {ERR => "$prog: file 1 is not in sorted order\n"
+          . "$prog: input is not in sorted order\n"}],
 
    # second input out-of-order extended
    ['ooo5c', {IN=>{a=>"0\n3"}}, {IN=>{b=>"2\n3\n1"}}, {EXIT=>1},
     {OUT => "0\n\t2\n\t\t3\n\t1\n"},
-    {ERR => "$prog: file 2 is not in sorted order\n"}],
+    {ERR => "$prog: file 2 is not in sorted order\n"
+          . "$prog: input is not in sorted order\n"}],
 
    # both inputs out-of-order, but fully pairable
    ['ooo6', {IN=>{a=>"2\n1\n0"}}, {IN=>{b=>"2\n1\n0"}}, {EXIT=>0},
index 0030f76c9846616c8655c50678cbf3f1906f7261..1e15b29b2b7d1c1d2fc7baa547949b14fcad9d5e 100755 (executable)
@@ -216,13 +216,17 @@ my @tv = (
 ['chkodr-5d', '',
  ["a\nx\n\n", "b\ny\n\n"], "", 1,
  "$prog: chkodr-5d.1:3: is not sorted: \n" .
- "$prog: chkodr-5d.2:3: is not sorted: \n"],
+ "$prog: chkodr-5d.2:3: is not sorted: \n" .
+ "$prog: input is not in sorted order\n"
+ ],
 
 # Similar, but make it so each offending line has no newline.
 ['chkodr-5e', '',
  ["a\nx\no", "b\ny\np"], "", 1,
  "$prog: chkodr-5e.1:3: is not sorted: o\n" .
- "$prog: chkodr-5e.2:3: is not sorted: p\n"],
+ "$prog: chkodr-5e.2:3: is not sorted: p\n" .
+ "$prog: input is not in sorted order\n"
+ ],
 
 # Without order check, both inputs out of order and some lines
 # unpairable.  This is NOT supported by the GNU extension.  All that