Skip to content

Commit 2f06a34

Browse files
committed
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 6b6146e.
1 parent b277665 commit 2f06a34

File tree

1 file changed

+0
-25
lines changed

1 file changed

+0
-25
lines changed

src/cmd/ksh93/tests/variables.sh

-25
Original file line numberDiff line numberDiff line change
@@ -693,31 +693,6 @@ do
693693
done
694694
PATH=$path
695695
696-
# Test what happens if the locale is invalid.
697-
locale -a | grep -E '^xyz(\..*)?$'
698-
if locale -a | grep -Eq '^xyz(\..*)?$'
699-
then
700-
# Most systems agree that "xyz" (with or without an encoding) is an unknown locale.
701-
log_warning "skipping invalid locale test since 'xyz' is a known locale" \
702-
"" "$(locale -a | grep -E '^xyz(\..*)?$')"
703-
else
704-
# We expect `xyz.UTF-8` to be an invalid locale that produces various diagnostics. This is
705-
# slightly convoluted because we are using nameref's to test that changing a locale env var
706-
# indirectly is handled correctly.
707-
for v in LC_ALL LC_CTYPE LC_MESSAGES LC_COLLATE LC_NUMERIC
708-
do
709-
nameref r=$v
710-
unset $v
711-
[[ -n $r ]] && log_error "unset $v failed" "" "$r"
712-
d=$($SHELL -c "$v=xyz.UTF-8" 2>&1)
713-
[[ -n $d ]] || log_error "$v=xyz.UTF-8 failed -- expected locale diagnostic" "" "$d"
714-
{ g=$( r=xyz.UTF-8; print -- $r ); }
715-
[[ $g == '' ]] || log_error "$v=xyz.UTF-8 failed" "" "$g"
716-
{ g=$( r=C; r=xyz.UTF-8; print -- $r ); }
717-
[[ $g == 'C' ]] || log_error "$v=C; $v=xyz.UTF-8 failed" "C" "$g"
718-
done
719-
fi
720-
721696
cd $TEST_DIR
722697
print print -n zzz > zzz
723698
chmod +x zzz

0 commit comments

Comments
 (0)