On 21/09/2025 21:40, Bruno Haible wrote:
Pádraig Brady wrote:
FAIL: tests/ls/block-size
Here is the relevant part of test-suite.log.
That looks to be an issue with a new part of the test added in this release.
Unfortunately the log doesn't have tracing enabled
(perhaps it might with `make check SHELL=/bin/bash` or something?)
Here's a log file produced with
VERBOSE=1 DEBUG=1 gmake check
That helps thanks.
It implies ls thinks the column width should be 3.
That implies that the mbswidth() in ls is returning an error for
$'10\302\240272'
It seems to be treating the non-breaking space char as non printable.
I'd already noted that for FreeBSD 11 in tests/wc/wc-nbsp.sh
So we've two options here.
Get the test to ignore this case, which could be done with:
diff --git a/tests/ls/block-size.sh b/tests/ls/block-size.sh
index 501c7f82b..d3111c279 100755
--- a/tests/ls/block-size.sh
+++ b/tests/ls/block-size.sh
@@ -193,6 +193,12 @@ done
# If any of these unavailable, the C fallback should also be aligned
for loc in sv_SE.UTF-8 $LOCALE_FR_UTF8; do
+
+ # Ensure we have a printable thousands separator
+ # This is not the case on FreeBSD 11/12 at least with NBSP
+ test $(LC_ALL=$loc ls -s1 --block-size=\'k file1M |
+ cut -dK -f1 | LC_ALL=$loc wc -L) = 5 || continue
+
test $(LC_ALL=$loc ls -s1 --block-size=\'k |
tail -n+2 | cut -dK -f1 |
while IFS= read size; do
Alternatively one could get better alignment in this case
by not passing MBSW_REJECT_UNPRINTABLE when aligning.
That would give unprintable characters a width of 1.
I was considering only doing this for numbers but maybe
it's best to simply do for all ls fields with:
diff --git a/src/ls.c b/src/ls.c
index d999d5bdf..8d2fb3596 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -1318,7 +1318,7 @@ file_escape_init (void)
RFC3986[i] |= c_isalnum (i) || i == '~' || i == '-' || i == '.' || i ==
'_';
}
-enum { MBSWIDTH_FLAGS = MBSW_REJECT_INVALID | MBSW_REJECT_UNPRINTABLE };
+enum { MBSWIDTH_FLAGS = MBSW_REJECT_INVALID };
/* Read the abbreviated month names from the locale, to align them
and to determine the max width of the field and to truncate names
I'm leaning towards the latter ls.c change.
Bruno I presume either patch fixes the test failure?
Paul (I'm asking since you recently added the REJECT_UNPRINTABLE)
I presume the latter ls.c patch is most appropriate here?
cheers,
Padraig