Daniel P. Berrange
2017-08-10 16:36:24 UTC
The maint.mk file currently sets LC_ALL=C so that build rules get a
predictable locale, independant of the user's environment settings.
It is sometimes neccesssary to override the locale when running
build commands from make rules, but as maint.mk set LC_ALL, it
is impossible to selectively override rules e.g. LC_CTYPE=C.UTF-8
will have no effect if LC_ALL is already set.
To deal with this maint.mk should instead set LANG=C, and then
explicitly unset all the other LC_* variables.
Signed-off-by: Daniel P. Berrange <***@redhat.com>
---
top/maint.mk | 24 +++++++++++++++++++++---
1 file changed, 21 insertions(+), 3 deletions(-)
diff --git a/top/maint.mk b/top/maint.mk
index 09a98bce8..2d8f1391b 100644
--- a/top/maint.mk
+++ b/top/maint.mk
@@ -144,9 +144,27 @@ today = $(shell date +%Y-%m-%d)
news-check-lines-spec ?= 1,10
news-check-regexp ?= '^\*.* $(VERSION_REGEXP) \($(today)\)'
-# Prevent programs like 'sort' from considering distinct strings to be equal.
-# Doing it here saves us from having to set LC_ALL elsewhere in this file.
-export LC_ALL = C
+# Ensure a stable locale, independant of the user's environment, so that
+# locale sensitive programs used in the build (eg 'sort') have predictable
+# output.
+#
+# We want apps to be able override individual locale categories in their
+# make rules though, so must not set LC_ALL ourselves, but instead use
+# LANG as the lowest priority variable.
+unexport LC_ALL
+unexport LC_CTYPE
+unexport LC_NUMERIC
+unexport LC_TIME
+unexport LC_COLLATE
+unexport LC_MONETARY
+unexport LC_MESSAGES
+unexport LC_PAPER
+unexport LC_NAME
+unexport LC_ADDRESS
+unexport LC_TELEPHONE
+unexport LC_MEASUREMENT
+unexport LC_IDENTIFICATION
+export LANG = C
## --------------- ##
## Sanity checks. ##
predictable locale, independant of the user's environment settings.
It is sometimes neccesssary to override the locale when running
build commands from make rules, but as maint.mk set LC_ALL, it
is impossible to selectively override rules e.g. LC_CTYPE=C.UTF-8
will have no effect if LC_ALL is already set.
To deal with this maint.mk should instead set LANG=C, and then
explicitly unset all the other LC_* variables.
Signed-off-by: Daniel P. Berrange <***@redhat.com>
---
top/maint.mk | 24 +++++++++++++++++++++---
1 file changed, 21 insertions(+), 3 deletions(-)
diff --git a/top/maint.mk b/top/maint.mk
index 09a98bce8..2d8f1391b 100644
--- a/top/maint.mk
+++ b/top/maint.mk
@@ -144,9 +144,27 @@ today = $(shell date +%Y-%m-%d)
news-check-lines-spec ?= 1,10
news-check-regexp ?= '^\*.* $(VERSION_REGEXP) \($(today)\)'
-# Prevent programs like 'sort' from considering distinct strings to be equal.
-# Doing it here saves us from having to set LC_ALL elsewhere in this file.
-export LC_ALL = C
+# Ensure a stable locale, independant of the user's environment, so that
+# locale sensitive programs used in the build (eg 'sort') have predictable
+# output.
+#
+# We want apps to be able override individual locale categories in their
+# make rules though, so must not set LC_ALL ourselves, but instead use
+# LANG as the lowest priority variable.
+unexport LC_ALL
+unexport LC_CTYPE
+unexport LC_NUMERIC
+unexport LC_TIME
+unexport LC_COLLATE
+unexport LC_MONETARY
+unexport LC_MESSAGES
+unexport LC_PAPER
+unexport LC_NAME
+unexport LC_ADDRESS
+unexport LC_TELEPHONE
+unexport LC_MEASUREMENT
+unexport LC_IDENTIFICATION
+export LANG = C
## --------------- ##
## Sanity checks. ##
--
2.13.3
2.13.3