Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Deprecation of egrep
> 2022/09/13 13:33, Jun T <takimoto-j@xxxxxxxxxxxxxxxxx> wrote:
>
> In the path below, I moved the repeated code for finding UTF-8 locale
> to a single function in ztst.zsh. The only other use of egrep is
> in E01options.zsh.
Sorry, with this patch D07 fails if users explicitly export LC_CTYPE=C
when running the test. Unsetting LC_\* in ZTST_find_UTF8() is not
sufficient.
I think we can simply unset LC_\* in ztst.zsh for ALL the tests
and rely only on LANG.
diff --git a/Test/ztst.zsh b/Test/ztst.zsh
index d95b726e7..ea1b016d5 100755
--- a/Test/ztst.zsh
+++ b/Test/ztst.zsh
@@ -25,23 +25,13 @@
# still not be good enough. Maybe we should trick it somehow.
emulate -R zsh
-# Ensure the locale does not screw up sorting. Don't supply a locale
-# unless there's one set, to minimise problems.
-[[ -n $LC_ALL ]] && LC_ALL=C
-[[ -n $LC_CTYPE ]] && LC_CTYPE=C
-[[ -n $LC_COLLATE ]] && LC_COLLATE=C
-[[ -n $LC_NUMERIC ]] && LC_NUMERIC=C
-[[ -n $LC_MESSAGES ]] && LC_MESSAGES=C
-[[ -n $LANG ]] && LANG=C
-# Test file may (or may not) set LANG to other locales. In either case,
-# LANG must be passed to child zsh.
-export LANG
+# By default tests are run in C locale. LANG must be passed to child zsh.
+unset -m LC_\*
+export LANG=C
# find UTF-8 locale
ZTST_find_UTF8 () {
setopt multibyte
- # Don't let LC_* override our choice of locale.
- unset -m LC_\*
local langs=(en_{US,GB}.{UTF-,utf}8 en.UTF-8
${(M)$(locale -a 2>/dev/null):#*.(utf8|UTF-8)})
for LANG in $langs; do
Messages sorted by:
Reverse Date,
Date,
Thread,
Author