Your message was unintentionally dropped from the list.
Thanks for taking the extra time to mail this directly.

Your analysis is correct, but setting LC_MESSAGES=C might not work in all cases.
We had issues previously with disparate LC_CTYPE and LC_MESSAGES on macos as 
per:
https://github.com/coreutils/coreutils/commit/04148c99c
So the attached adjusts things to only look for the problematic
character in the warning.

cheers,
Pádraig

-------- Forwarded Message --------
Subject: [a...@offog.org: Re: new snapshot available: 
coreutils-9.0.193-54bec.tar.xz]
Date: Mon, 11 Apr 2022 03:17:15 +0100
From: Adam Sampson <a...@offog.org>
To: p...@draigbrady.com

Hi Pádraig,

(Apologies if this is a duplicate - I sent it to the coreutils@ list but
it hasn't come through.)

Pádraig Brady <p...@draigbrady.com> writes:
>     cd coreutils-9.0.193-54bec/
>     ./configure && make check VERBOSE=yes

I've just tried this and I get one failure in the new printf-mb test --
the log is below. Since LC_ALL is set to fr_FR.UTF-8, the error messages
are printed in French, and the test script is expecting them to be in
English; should it set LC_MESSAGES=C like ls/dired.sh does?

(This is on a custom GNU/Linux system with glibc 2.35 and coreutils 9.0
installed.)

Thanks,
Adam

FAIL: tests/misc/printf-mb
==========================


+ diff -u exp_err err
--- exp_err     2022-04-09 17:10:01.144175356 +0100
+++ err 2022-04-09 17:10:01.142175368 +0100
@@ -1,2 +1,2 @@
-printf: warning: ": character(s) following character constant have been ignored
-printf: warning: ': character(s) following character constant have been ignored
+printf: avertissement: " : caractères suivant la constante caractère ont 
été ignorés
+printf: avertissement: ' : caractères suivant la constante caractère ont 
été ignorés
+ fail=1
From 2dafb4c0616d1a12917e35278fb9a2f74461d5f7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <p...@draigbrady.com>
Date: Mon, 11 Apr 2022 13:47:44 +0100
Subject: [PATCH] tests: printf-mb.sh: fix false failure with french
 translations

* tests/misc/printf-mb.sh: As per commit 04148c99c,
adjust non C warnings to those of LC_MESSAGES=C before comparison.
Reported by Adam Sampson
---
 tests/misc/printf-mb.sh | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/tests/misc/printf-mb.sh b/tests/misc/printf-mb.sh
index 69ed3dfe8..f2f32c8a7 100755
--- a/tests/misc/printf-mb.sh
+++ b/tests/misc/printf-mb.sh
@@ -33,9 +33,9 @@ if test "$LOCALE_FR_UTF8" != "none"; then
    #uni-byte
    LC_ALL=C $prog '%04x\n' "'$($prog '\xe1')" >>out 2>>err
    #valid multi-byte, with trailing
-   LC_ALL=$f $prog '%04x\n' '"á"' >>out 2>>err
+   LC_ALL=$f $prog '%04x\n' '"á=' >>out 2>>err
    #invalid multi-byte, with trailing
-   LC_ALL=$f $prog '%04x\n' "'$($prog '\xe1')'" >>out 2>>err
+   LC_ALL=$f $prog '%04x\n' "'$($prog '\xe1')=" >>out 2>>err
   )
   cat <<\EOF > exp || framework_failure_
 00e1
@@ -46,11 +46,19 @@ if test "$LOCALE_FR_UTF8" != "none"; then
 EOF
   compare exp out || fail=1
 
+  # Disparate LC_CTYPE and LC_MESSAGES problematic on macos,
+  # so just look for character in warning message,
+  # and normalize to LC_MESSAGES=C
+  C_WARNING='printf: '\
+'warning: =: character(s) following character constant have been ignored'
+
+  sed "s/printf:.*=.*/$C_WARNING/" < err > c_err || framework_failure_
+
   cat <<EOF > exp_err
-printf: warning: ": character(s) following character constant have been ignored
-printf: warning: ': character(s) following character constant have been ignored
+$C_WARNING
+$C_WARNING
 EOF
-  compare exp_err err || fail=1
+  compare exp_err c_err || fail=1
 fi
 
 Exit $fail
-- 
2.26.2

Reply via email to