]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: fix integer overflow in sort-float
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 10 Jul 2025 17:17:29 +0000 (10:17 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 10 Jul 2025 17:18:06 +0000 (10:18 -0700)
Problem reported by Cosima Neidahl <https://bugs.gnu.org/78985>.
* tests/sort/sort-float.sh (dbl_minima_order):
Use expr instead of test to compare fractions,
to avoid problems with integers too large for the shell.

tests/sort/sort-float.sh

index 3fa11a0ebf118e7fbbe77168e009915428476040..318ba48fbd3633549e3a0a2641a49f5e2f12d047 100755 (executable)
@@ -46,7 +46,8 @@ dbl_minima_order()
   test "$ldbl_exp"   -lt "$dbl_exp"    && return 1
   test "$ldbl_whole" -lt "$dbl_whole"  && return 0
   test "$dbl_whole"  -lt "$ldbl_whole" && return 1
-  test "$ldbl_frac"  -le "$dbl_frac"   && return 0
+  # Use 'expr' not 'test', as these integers may be large.
+  expr "$ldbl_frac" '<=' "$dbl_frac" >/dev/null && return 0
   return 1
 }