From 2f06a34e737cb2a0d8c1a052d97924ad27e445e0 Mon Sep 17 00:00:00 2001 From: Kurtis Rader Date: Tue, 14 Jan 2020 20:10:43 -0800 Subject: [PATCH] Eliminate bogus locale tests Some platforms (e.g., OpenBSD) allow pretty much any locale string. And it is not clear why it is the responsibility of ksh to issue a diagnostic if an invalid locale is specified by the user. Or why we should be testing for this situation. Even ksh93u+, which uses the AST locale subsystem, doesn't produce a diagnostic message when doing `LC_CTYPE=xyz.UTF-8` on OpenBSD. This is a follow up to commit 6b6146e7. --- src/cmd/ksh93/tests/variables.sh | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/src/cmd/ksh93/tests/variables.sh b/src/cmd/ksh93/tests/variables.sh index 512b8fc42de6..064d14a8aebc 100644 --- a/src/cmd/ksh93/tests/variables.sh +++ b/src/cmd/ksh93/tests/variables.sh @@ -693,31 +693,6 @@ do done PATH=$path -# Test what happens if the locale is invalid. -locale -a | grep -E '^xyz(\..*)?$' -if locale -a | grep -Eq '^xyz(\..*)?$' -then - # Most systems agree that "xyz" (with or without an encoding) is an unknown locale. - log_warning "skipping invalid locale test since 'xyz' is a known locale" \ - "" "$(locale -a | grep -E '^xyz(\..*)?$')" -else - # We expect `xyz.UTF-8` to be an invalid locale that produces various diagnostics. This is - # slightly convoluted because we are using nameref's to test that changing a locale env var - # indirectly is handled correctly. - for v in LC_ALL LC_CTYPE LC_MESSAGES LC_COLLATE LC_NUMERIC - do - nameref r=$v - unset $v - [[ -n $r ]] && log_error "unset $v failed" "" "$r" - d=$($SHELL -c "$v=xyz.UTF-8" 2>&1) - [[ -n $d ]] || log_error "$v=xyz.UTF-8 failed -- expected locale diagnostic" "" "$d" - { g=$( r=xyz.UTF-8; print -- $r ); } - [[ $g == '' ]] || log_error "$v=xyz.UTF-8 failed" "" "$g" - { g=$( r=C; r=xyz.UTF-8; print -- $r ); } - [[ $g == 'C' ]] || log_error "$v=C; $v=xyz.UTF-8 failed" "C" "$g" - done -fi - cd $TEST_DIR print print -n zzz > zzz chmod +x zzz