From: Paul Eggert Date: Thu, 10 Jul 2025 17:17:29 +0000 (-0700) Subject: tests: fix integer overflow in sort-float X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8f9fc8f08c10c3b097211f95c6354a85d41f1101;p=thirdparty%2Fcoreutils.git tests: fix integer overflow in sort-float Problem reported by Cosima Neidahl . * 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. --- diff --git a/tests/sort/sort-float.sh b/tests/sort/sort-float.sh index 3fa11a0ebf..318ba48fbd 100755 --- a/tests/sort/sort-float.sh +++ b/tests/sort/sort-float.sh @@ -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 }