From bf76268d2408e2efcf62a1027bc0420e932c48ee Mon Sep 17 00:00:00 2001 From: Martijn Dekker Date: Tue, 11 May 2021 18:59:38 +0200 Subject: [PATCH] tests/locale.sh: skip SJIS test on non-SJIS locale (re: c2cb0eae) On Fedora, this regression test failure occurs: locale.sh[84]: 'read' doesn't skip multibyte input correctly (ja_JP.ujis, \x95\x5c) This is a problem with the test; this Shift-JIS specific test should not be run in a non-Shift-JIS locale. So this commit skips it unless the locale string ends in '.SJIS' (case insensitive). It also adds cleanup for the 'chr' variable's special attributes in case that name is ever going to be used in another test. --- src/cmd/ksh93/tests/locale.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cmd/ksh93/tests/locale.sh b/src/cmd/ksh93/tests/locale.sh index 4c666744a..91d0b5627 100755 --- a/src/cmd/ksh93/tests/locale.sh +++ b/src/cmd/ksh93/tests/locale.sh @@ -81,10 +81,11 @@ do [[ $locale == *[Jj][Ii][Ss] ]] || continue # dangling final backslash (which is invalid) and return a nonzero exit status. # Note that the byte sequence '\x95\x5c' represents a multibyte character U+8868, # whereas '\x5c' is a backslash when interpreted as a single-byte character. + [[ $locale == *.[Ss][Jj][Ii][Ss] ]] || continue printf "\x95\x$c\n" | read x || err_exit "'read' doesn't skip multibyte input correctly ($LC_ALL, \x95\x$c)" done done -unset LC_ALL +unset LC_ALL chr # Test the effect of setting a locale, followed by setting a different locale # then setting the previous locale. The output from 'printf %T' should use