diff mbox

Remove locale-related environment variables from subprocess environments

Message ID 540DA507.2090400@redhat.com
State New
Headers show

Commit Message

Florian Weimer Sept. 8, 2014, 12:45 p.m. UTC
This avoids a few testsuite failures if the user has set such variables.

Comments

Roland McGrath Sept. 9, 2014, 9:11 p.m. UTC | #1
I think we probably want these to be explicit in test-wrapper rather than
done at the make level.  That would cover more obscure cases, such as
cross-test-ssh when default hooey on the remote side sets some of those
variables.
Florian Weimer Sept. 10, 2014, 10:23 a.m. UTC | #2
On 09/09/2014 11:11 PM, Roland McGrath wrote:
> I think we probably want these to be explicit in test-wrapper rather than
> done at the make level.  That would cover more obscure cases, such as
> cross-test-ssh when default hooey on the remote side sets some of those
> variables.

Hmm.  Is it fine to require that test-wrapper-env supports the -u option 
of env?  There is no other way to unset environment variables at this 
point, as far as I can see.
Roland McGrath Sept. 10, 2014, 5:46 p.m. UTC | #3
> Hmm.  Is it fine to require that test-wrapper-env supports the -u option 
> of env?  There is no other way to unset environment variables at this 
> point, as far as I can see.

I think using -u is OK, but Joseph might have an opinion.  If it's a
problem, then for all these particular variables setting them to empty is
probably equivalent.
Joseph Myers Sept. 10, 2014, 8:32 p.m. UTC | #4
On Wed, 10 Sep 2014, Roland McGrath wrote:

> > Hmm.  Is it fine to require that test-wrapper-env supports the -u option 
> > of env?  There is no other way to unset environment variables at this 
> > point, as far as I can see.
> 
> I think using -u is OK, but Joseph might have an opinion.  If it's a
> problem, then for all these particular variables setting them to empty is
> probably equivalent.

Well, you need to update the documentation in install.texi of what the 
arguments to test-wrapper-env look like.  But I'm not aware of any wrapper 
implementations that don't just go through env (whether by using 
cross-test-ssh.sh, or the default empty wrapper), though in principle you 
could have such an implementation (e.g. using userspace QEMU, where the 
program "env" may not exist in a form it can execute ... not that I know 
if userspace QEMU actually has a suitable mechanism for setting 
environment variables that only apply to the emulated program and not to 
QEMU itself).  A NEWS entry mentioning the new requirements might still be 
a good idea.
Andreas Schwab Sept. 10, 2014, 10:15 p.m. UTC | #5
"Joseph S. Myers" <joseph@codesourcery.com> writes:

> not that I know 
> if userspace QEMU actually has a suitable mechanism for setting 
> environment variables that only apply to the emulated program and not to 
> QEMU itself).

-E var=value  QEMU_SET_ENV      sets targets environment variable (see below)
-U var        QEMU_UNSET_ENV    unsets targets environment variable (see below)

Andreas.
diff mbox

Patch

From a70c397f88315bd66f28aaf1471e9b37d774c95f Mon Sep 17 00:00:00 2001
From: Florian Weimer <fweimer@redhat.com>
Date: Mon, 8 Sep 2014 14:15:29 +0200
Subject: Remove locale-related environment variables from subprocess environments

This avoids a few testsuite failures if the user has set such
variables.
---
 ChangeLog  | 10 ++++++++++
 Makeconfig | 27 +++++++++++++++++++++++++--
 2 files changed, 35 insertions(+), 2 deletions(-)

 2014-09-08  Florian Weimer  <fweimer@redhat.com>
 
	* Makeconfig (.NOEXPORT): Remove, no longer supported by GNU Make.
	(CHARSET, GCONV_PATH, I18NPATH, LANG, LANGUAGE, LANGUAGES,
	LC_ADDRESS, LC_ALL, LC_COLLATE, LC_CTYPE, LC_IDENTIFICATION,
	LC_MEASUREMENT, LC_MESSAGES, LC_MONETARY, LC_NAME, LC_NUMERIC,
	LC_PAPER, LC_TELEPHONE, LC_TIME, LOCPATH, NLSPATH,
	OUTPUT_CHARSET): Unexport (and implicitly clear)
	environment variables

diff --git a/Makeconfig b/Makeconfig
index 0f8069b..2bb9e9f 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -760,8 +760,31 @@  endif
 #### End of configuration variables.
 ####
 
-# This tells some versions of GNU make before 3.63 not to export all variables.
-.NOEXPORT:
+# Unexport (and thus implicitly clear) locale-related environment
+# variables.
+unexport CHARSET
+unexport GCONV_PATH
+unexport I18NPATH
+unexport LANG
+unexport LANGUAGE
+unexport LANGUAGES
+unexport LC_ADDRESS
+unexport LC_ALL
+unexport LC_COLLATE
+unexport LC_CTYPE
+unexport LC_IDENTIFICATION
+unexport LC_MEASUREMENT
+unexport LC_MESSAGES
+unexport LC_MONETARY
+unexport LC_NAME
+unexport LC_NUMERIC
+unexport LC_PAPER
+unexport LC_TELEPHONE
+unexport LC_TIME
+unexport LOCPATH
+unexport NLSPATH
+unexport OUTPUT_CHARSET
+
 
 # We want to echo the commands we're running without
 # umpteen zillion filenames along with it (we use `...' instead)
-- 
1.9.3