]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: avoid false failure due to mismatched isblank()
authorPádraig Brady <P@draigBrady.com>
Tue, 26 Mar 2024 15:02:17 +0000 (15:02 +0000)
committerPádraig Brady <P@draigBrady.com>
Tue, 26 Mar 2024 16:53:09 +0000 (16:53 +0000)
There is a mismatch between isblank() used by tr and c32isblank() now
used by uniq on Solaris 11 OpenIndiana. isblank() was seen to return
true for non breaking space, while c32isblank() returned false.
Interestingly on Solaris, non breaking space is considered a blank
character, and isblank() and c32isblank() honor this in all locales.

* tests/uniq/uniq.pl: Adjust the blank check to use join(1) rather than
tr(1), as join uses the same blank determination routines as uniq(1).

tests/uniq/uniq.pl

index 34457b000668d822a4287dfcf50feb83c5d074fb..a61f26485890122e68973dcec4b8166819ef336d 100755 (executable)
@@ -243,8 +243,9 @@ if ( defined $locale && $locale ne 'none' )
   {
     # I've only ever triggered the problem in a non-C locale.
 
-    # See if isblank returns true for nbsp.
-    my $x = qx!env printf '\xa0'| LC_ALL=$locale tr '[:blank:]' x!;
+    # See if nbsp is considered a blank character
+    my $x = qx!env printf 'x\xa0y'| LC_ALL=$locale join -a2 -o2.1 /dev/null -!;
+    chomp $x;
     # If so, expect just one line of output in the schar test.
     # Otherwise, expect two.
     my $in = " y z\n\xa0 y z\n";