[parted-devel] [PATCH] tests: Fall back to C.UTF-8 if no en_US available

Brian C. Lane bcl at redhat.com
Wed Jul 30 16:13:31 UTC 2014


Not all distributions (Fedora) have C.UTF-8 so first try en_US and fall
back to it. This may still fail if neither exist.

* tests/t0251-gpt-unicode.sh: Test for en_US and fall back to C.UTF-8
---
 tests/t0251-gpt-unicode.sh | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tests/t0251-gpt-unicode.sh b/tests/t0251-gpt-unicode.sh
index c845950..a51f541 100755
--- a/tests/t0251-gpt-unicode.sh
+++ b/tests/t0251-gpt-unicode.sh
@@ -22,7 +22,11 @@ dev=loop-file
 # create zeroed device
 truncate -s 10m $dev || fail=1
 
-export LC_ALL=C.UTF-8
+if [ -e "/usr/share/locale/en_US/" ]; then
+    export LC_ALL=en_US.UTF-8
+else
+    export LC_ALL=C.UTF-8
+fi
 # create gpt label with named partition
 part_name=$(printf 'foo\341\264\244')
 parted -s $dev mklabel gpt mkpart primary ext2 1MiB 2MiB name 1 $part_name > empty 2>&1 || fail=1
-- 
1.9.3




More information about the parted-devel mailing list