]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: fix false failure on Centos 7
authorPádraig Brady <P@draigBrady.com>
Thu, 16 Apr 2026 16:42:33 +0000 (17:42 +0100)
committerPádraig Brady <P@draigBrady.com>
Thu, 16 Apr 2026 16:44:05 +0000 (17:44 +0100)
* tests/date/date-locale-hour.sh: Ensure `locale date_fmt`
is propagated exactly, even when it contains trailing new lines,
as was seen with Serbian locales on Centos 7.

tests/date/date-locale-hour.sh

index e2353ec330db9ecec5c729a9c2ebf6047b71f266..a368fb77d782ec1e0c9bd891e4b5b241242fe65d 100755 (executable)
@@ -59,7 +59,8 @@ done
 # Make sure 'date' can use the format string given by 'locale date_fmt'
 # and that it uses it by default when no format string is given.
 for loc in $(locale -a | shuf -n 10); do
-  fmt=$(LC_ALL=$loc locale date_fmt)
+  fmt="$(LC_ALL=$loc locale date_fmt; printf x)"
+  fmt=${fmt%$'\n'x}  # Retain fmt newlines (seen with Serbian on Centos 7)
   if test -n "$fmt"; then
     LC_ALL=$loc date -d '2025-10-11T13:00' +"$fmt" > $loc.exp || fail=1
     LC_ALL=$loc date -d '2025-10-11T13:00' > $loc.out || fail=1