summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Tojnar <jtojnar@gmail.com>2018-06-03 00:25:31 +0200
committerAtomic Bot <atomic-devel@projectatomic.io>2018-06-03 21:25:07 +0000
commitf200efdb8ae7189e8e50e2e934bfaad3f14eaa9b (patch)
tree7ccee2eb4607f5e2a3cf2f39bef8852ae9275ab3
parentbf3525adcbdcafa67597c216ed4465d4bceadd54 (diff)
downloadostree-f200efdb8ae7189e8e50e2e934bfaad3f14eaa9b.tar.gz
tests: Fix locale detection
When a locale with C.utf8 in its name (e.g. es_EC.utf8) was installed on a system, the C.utf8 locale was chosen, even when it was not available. This patch fixes the grep pattern to match whole lines returned by locale -a. See: #1592 Closes: #1611 Approved by: cgwalters
-rw-r--r--tests/libtest-core.sh4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/libtest-core.sh b/tests/libtest-core.sh
index 6991a86d..f6f94288 100644
--- a/tests/libtest-core.sh
+++ b/tests/libtest-core.sh
@@ -37,9 +37,9 @@ assert_not_reached () {
# Some tests look for specific English strings. Use a UTF-8 version
# of the C (POSIX) locale if we have one, or fall back to POSIX
# (https://sourceware.org/glibc/wiki/Proposals/C.UTF-8)
-if locale -a | grep C.UTF-8 >/dev/null; then
+if locale -a | grep '^C.UTF-8$' >/dev/null; then
export LC_ALL=C.UTF-8
-elif locale -a | grep C.utf8 >/dev/null; then
+elif locale -a | grep '^C.utf8$' >/dev/null; then
export LC_ALL=C.utf8
else
export LC_ALL=C