sort: don't print uninitialized in diagnostic
authorJim Meyering <meyering@redhat.com>
Sun, 10 Aug 2008 08:51:03 +0000 (10:51 +0200)
committerJim Meyering <meyering@redhat.com>
Sun, 10 Aug 2008 14:48:55 +0000 (16:48 +0200)
* src/sort.c (specify_nmerge): Do use uinttostr value.
Provoke with e.g., sort -m --batch-size=18446744073709551617
Omit quotes around known-numeric value in diagnostic.
* tests/misc/sort-merge [nmerge-big]: Tighten ERR_SUBST regexp
to require a numeric value in that diagnostic, so this particular
failure cannot reappear.

src/sort.c
tests/misc/sort-merge

index 9f998a6..74318b9 100644 (file)
@@ -1111,12 +1111,12 @@ specify_nmerge (int oi, char c, char const *s)
   if (e == LONGINT_OVERFLOW)
     {
       char max_nmerge_buf[INT_BUFSIZE_BOUND (unsigned int)];
-      uinttostr (max_nmerge, max_nmerge_buf);
       error (0, 0, _("--%s argument %s too large"),
             long_options[oi].name, quote(s));
       error (SORT_FAILURE, 0,
             _("maximum --%s argument with current rlimit is %s"),
-            long_options[oi].name, quote (max_nmerge_buf));
+            long_options[oi].name,
+            uinttostr (max_nmerge, max_nmerge_buf));
     }
   else
     xstrtol_fatal (e, oi, c, long_options, s);
index fb7c63c..985d7a4 100755 (executable)
@@ -55,9 +55,9 @@ my @Tests =
         {ERR=>"$prog: invalid --batch-size argument `a'\n"}, {EXIT=>2}],
 
      ['nmerge-big', "-m --batch-size=$bigint", @inputs,
-       {ERR_SUBST=>'s/current rlimit is .+\n/current rlimit is/'},
+       {ERR_SUBST=>'s/(current rlimit is) \d+/$1/'},
         {ERR=>"$prog: --batch-size argument `$bigint' too large\n".
-             "$prog: maximum --batch-size argument with current rlimit is"},
+             "$prog: maximum --batch-size argument with current rlimit is\n"},
         {EXIT=>2}],
 
      # This should work since nmerge >= the number of input files