-
-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test for working en_US.UTF-8 locale #108
Conversation
.circleci/test_docker_container.sh
Outdated
@@ -2,6 +2,12 @@ | |||
|
|||
set -xeuo pipefail | |||
|
|||
# test for working en_US.UTF-8 locale | |||
locale -a | grep -i 'en_US.UTF.\?8' | |||
[ "$( LC_ALL=en_US.UTF-8 sh -euc : 2>&1 )" = "" ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would spit out
/usr/bin/sh: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8): No such file or directory
on stderr
if the locale wouldn't work. If it works, we just get no output and can test for that.
Yep, that was is. All fixed now. I'll open an upstream PR. |
|
linux-anvil-cuda/Dockerfile
Outdated
@@ -38,7 +30,14 @@ RUN yum update -y && \ | |||
sudo \ | |||
tar \ | |||
which && \ | |||
yum clean all | |||
: '(centos:6 only) If glibc-common is updated, we have to manually purge non-en_US locales.' && \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docker doesn't like real comments as part of a multi-line RUN
so we have to work around that if we want them.
(Ab-)using the null utility (special built-in) :
for this is a little hacky, TBH, but it really doesn't do any harm, so it is perfectly fine in my book.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we move this out into a bash script that we add and run to all Dockerfile
s? This will ensure we only need to update and maintain this in one spot (as opposed to every Docker image), which will keep things maintainable here. Also we can format this more nicely without having to deal with Docker's syntax oddities. 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I had the same thing in mind. I was just in the "meh, I'll likely refactor stuff later anyway when proposing multi-staged builds, so whatever" state 😉 .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now it uses a common script in all images so that the rm -rf /var/cache/yum/*
addition is only in one place, too.
This is good to go, please take a look.
|
.circleci/test_docker_container.sh
Outdated
locale -a | grep -i 'en_US.UTF.\?8' | ||
[ "$( LC_ALL=en_US.UTF-8 sh -euc : 2>&1 )" = "" ] | ||
# make sure the above fails for non-existent locale | ||
[ ! "$( LC_ALL=badlocale sh -euc : 2>&1 )" = "" ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice
Looks pretty good, but I'm no expert :/ |
Oh, and apart from testing/fixing the locale, this also shrinks the (squashed, uncompressed) |
Thanks for the review @hmaarrfk! |
.circleci/test_docker_container.sh
Outdated
@@ -2,6 +2,12 @@ | |||
|
|||
set -xeuo pipefail | |||
|
|||
# test for working en_US.UTF-8 locale |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add some echo messages here so that is is clear in the logs what is actually going on here? Mostly just a line saying validate utf8 locale configured correctly.
(Also remove unused '-eu' in 'sh -c' call)
@@ -2,6 +2,12 @@ | |||
|
|||
set -xeuo pipefail | |||
|
|||
echo 'Validating correctly configured en_US.UTF-8 locale...' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mariusvniekerk, like so?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
# (centos:6 only) If glibc-common is updated, we have to manually purge non-en_US locales. | ||
if grep -F 'CentOS release 6' /etc/centos-release ; then | ||
if locale -a | grep nds_DE ; then | ||
cp /usr/lib/locale/locale-archive /usr/lib/locale/locale-archive.tmpl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(cp
instead of mv
to avoid writing to the mmapped file later.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we make that a comment in the script?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nah, not really important. The only change I expect to happen to this code is to be removed whenever this isn't needed anymore, e.g., when we use Centos 7 everywhere.
I just added the comment for my future self if I ever wondered why I changed that.
This would be ready to merge. However, Travis didn't run somehow... Any ideas? |
Travis is running. But it's not listed as one of the "checks" needed. Strange. |
RUN yum update -y && \ | ||
yum install -y \ | ||
bzip2 \ | ||
sudo \ | ||
tar \ | ||
which && \ | ||
yum clean all && \ | ||
rm -rf /var/cache/yum/* | ||
/opt/docker/bin/yum_clean_all |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should just move all of this into that script.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this and other parts can/should be consolidated. But let's do further cleanup.maintenance work later, not in this PR.
Travis build finished.... and is listed as "Pending — The Travis CI build is in progress"... right... Well, ready to merge from my side. |
If you really want the full green orb treatment you may want to restart the Travis build. I don't care too much about that :) |
Oh, I like many kinds of green hues -- olive green is a nice one; all good ;). |
Do we really need the changes from gh-83 and gh-97?
It seems like CentOS/sig-cloud-instance-images#71 is a resolved issue and the locale is working, isn't it?
I'd rather like us to test whether the locale is working and only apply fixes if it really is not.
I couldn't find a reference to a recent issue in gh-83. @mariusvniekerk, @hmaarrfk, can you point me to failing cases such that we can incorporate them in the tests?
Also, @mariusvniekerk, gh-83 has been for
aarch64
only. The only significant difference toppc64le
I could find is thataarch64
does not have CentOS/sig-cloud-instance-build@2892c17#diff-574fa022ad7d0be565da139e942a15cbR92 , i.e., it hasoverride_install_langs=en_US.UTF-8
in/etc/yum.conf
instead ofen_US.utf8
. If that is the culprit, we should change that (and upstream it, of course).