bug#78985: sort-float failure on ppc64, LDBL_MIN fraction part too long for test command to parse

Paul Eggert <[email protected]>
Newsgroups gmane.comp.gnu.core-utils.bugs
Organization UCLA Computer Science Department
Message-ID <[email protected]>
Thanks for reporting that false positive in the test. I installed the 
attached patch, which should fix things.
0001-tests-fix-integer-overflow-in-sort-float.patch (text/x-patch, 1 KB)
From 8f9fc8f08c10c3b097211f95c6354a85d41f1101 Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email protected]>
Date: Thu, 10 Jul 2025 10:17:29 -0700
Subject: [PATCH] tests: fix integer overflow in sort-float

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 | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/sort/sort-float.sh b/tests/sort/sort-float.sh
index 3fa11a0eb..318ba48fb 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
 }
 
-- 
2.48.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.