enter_chroot: move C.UTF-8 mangling before chroot usage
We convert C.UTF-8 to en_US.UTF-8, but we did it before we tried to
enter the SDK & initialize the env. Move that earlier so we pass in
the right setting.
This also means we can delete the explicit check for C.UTF-8 which
is breaking on builders using that locale.
BUG=chromium:1052082, chromium:1069678
TEST=`LC_ALL=C.UTF-8 cros_sdk` works
Change-Id: I68473b9c2bab3522090249db9e10adbac9746a14
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosutils/+/2145030
Reviewed-by: Alex Klein <saklein@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
diff --git a/sdk_lib/enter_chroot.sh b/sdk_lib/enter_chroot.sh
index 0b93ad8..489b7a6 100755
--- a/sdk_lib/enter_chroot.sh
+++ b/sdk_lib/enter_chroot.sh
@@ -265,16 +265,6 @@
die_notrace "Please fix your locale settings by setting LANG to UTF-8" \
"compatible locale and removing any LC_ variable settings."
fi
-
- # C.UTF8 is not standard currently unfortunately.
- local var
- for var in LANG LC_ALL LC_CTYPE; do
- if [[ "${!var}" == "C.UTF-8" ]]; then
- error "Sorry, but C.UTF-8 is not currently supported."
- locale
- die_notrace "Please use a different locale when building CrOS."
- fi
- done
}
generate_locales() {
@@ -701,19 +691,6 @@
) 200>>"$LOCKFILE" || die "setup_env failed"
}
-check_locale
-setup_env
-
-CHROOT_PASSTHRU=(
- "BUILDBOT_BUILD=$FLAGS_build_number"
- "CHROMEOS_RELEASE_APPID=${CHROMEOS_RELEASE_APPID:-{DEV-BUILD}}"
- "EXTERNAL_TRUNK_PATH=${FLAGS_trunk}"
-
- # The default ~/.bash_profile in chroot will cd to $CHROOT_CWD instead of
- # ~/trunk/src/script if that environment variable is set.
- "CHROOT_CWD=${FLAGS_working_dir}"
-)
-
# Translate C.UTF-8 into something we support. Remove this when our glibc
# starts supporting C.UTF-8. https://bugzilla.redhat.com/show_bug.cgi?id=902094
for var in LANG \
@@ -728,6 +705,19 @@
fi
done
+check_locale
+setup_env
+
+CHROOT_PASSTHRU=(
+ "BUILDBOT_BUILD=$FLAGS_build_number"
+ "CHROMEOS_RELEASE_APPID=${CHROMEOS_RELEASE_APPID:-{DEV-BUILD}}"
+ "EXTERNAL_TRUNK_PATH=${FLAGS_trunk}"
+
+ # The default ~/.bash_profile in chroot will cd to $CHROOT_CWD instead of
+ # ~/trunk/src/script if that environment variable is set.
+ "CHROOT_CWD=${FLAGS_working_dir}"
+)
+
# Needs to be set here because setup_env runs in a subshell.
[ -S "${FLAGS_chroot}/tmp/ssh-auth-sock" ] && SSH_AUTH_SOCK=/tmp/ssh-auth-sock