From 91ba21dd6c1bab95ac8ba6ac3b50c03d9f8a5650 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Wed, 3 May 2017 11:31:11 +1000 Subject: [PATCH] Set LC_ALL in disk-image-create It seems that the redhat nodepool job is quite reliably geting a "floating point" error during centos image build. This happens after 03-yum-cleanup which is pruning the locales. This might be a red-herring, since the logs are full of /bin/bash: warning: setlocale: LC_ALL: cannot change locale (C.UTF-8) I think in our recent de-puppetisation of hosts, something might have changed that is setting LC_ALL=C.UTF-8 for the jenkins user, at least on Ubuntu. This is a problem for centos, as it doesn't have C.UTF-8 locale. I then think using the invalid locale is what leads the the floating-point error when doing some maths in dib-run-parts to calculate runtimes. We are currently overriding LANG, but we really want LC_ALL to ensure this applies globally. Change-Id: I8e7cae093c4b32e0d20b73ae0086f14c7cc6a9cb --- diskimage_builder/lib/disk-image-create | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/diskimage_builder/lib/disk-image-create b/diskimage_builder/lib/disk-image-create index 71158209..e559aba5 100644 --- a/diskimage_builder/lib/disk-image-create +++ b/diskimage_builder/lib/disk-image-create @@ -16,9 +16,13 @@ set -eE -# Prevent perl from complaining a lot, but also remove any unexpected side-effects -# of $LANG varying between build hosts -export LANG=C +# Set/override locale. This ensures consistency in sorting etc. We +# need to choose a lowest-common denominator locale, as this is +# applied when running in the building chroot too (maybe a bug and we +# should prune this?). Thus "C" --centOS 7 doesn't include C.utf-8 +# (fedora does, centos 8 probably will). Note: LC_ALL to really +# override this; it overrides LANG and all other LC_ vars +export LC_ALL=C # Store our initial environment and command line args for later export DIB_ARGS="$@"