summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <meyering@fb.com>2014-11-08 18:59:24 -0800
committerJim Meyering <meyering@fb.com>2014-11-08 19:01:21 -0800
commit2ac355101d867f3231fd62ee131c0c98bb2eafa1 (patch)
treec46dee5f511d663e9f40ffdc398e996544a7f7bb
parent393d19a58d48daad81536b54d92847f29f362740 (diff)
downloadgrep-2ac355101d867f3231fd62ee131c0c98bb2eafa1.tar.gz
tests: avoid a multibyte tr portability problem
* tests/init.cfg (tr): New wrapper function. See comments for details. Reported by Norihiro Tanaka in http://debbugs.gnu.org/18991
-rw-r--r--tests/init.cfg9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/init.cfg b/tests/init.cfg
index 75a94941..e7a23893 100644
--- a/tests/init.cfg
+++ b/tests/init.cfg
@@ -162,3 +162,12 @@ hex_printf_()
printf $(printf '\\%o' \
$(printf %s "$1"|sed 's,\\x\([0-9a-fA-F][0-9a-fA-F]\), 0x\1,g'))
}
+
+# Wrap tr so that it always runs in the C locale.
+# Otherwise, in a multibyte locale, GNU tr (which is not multibyte-aware
+# as of 2014-11-08), would work differently than others. For example,
+# this command, which was written with unibyte GNU tr in mind,
+# LC_ALL=ja_JP.eucJP tr AB '\244\263'
+# would act like this with the multibyte tr from HP-UX and Solaris:
+# LC_ALL=ja_JP.eucJP tr A '\244\263'
+tr() { LC_ALL=C env -- tr "$@"; }