Fix handling for TEMP, TMP, and TMPDIR variables:
authorZac Medico <zmedico@gentoo.org>
Wed, 9 Dec 2009 00:30:46 +0000 (00:30 -0000)
committerZac Medico <zmedico@gentoo.org>
Wed, 9 Dec 2009 00:30:46 +0000 (00:30 -0000)
* Add to whitelist so current values are always used.
* Always filter them from the saved environment.
* Always add thier values to SANDBOX_WRITE.

svn path=/main/trunk/; revision=14973

bin/ebuild.sh
bin/isolated-functions.sh
pym/portage/__init__.py

index ef8dc2a0d42caa5bc3f447502fbecce5f20d1122..fd14314d68bf1d824a3fc927cfe05f67bb6e8b24 100755 (executable)
@@ -11,6 +11,12 @@ PORTAGE_PYM_PATH="${PORTAGE_PYM_PATH:-/usr/lib/portage/pym}"
 # environment by modifying our PATH.
 unset BASH_ENV
 
+# Avoid sandbox violations in temporary directories.
+for x in TEMP TMP TMPDIR ; do
+       [[ -n ${!x} ]] && export SANDBOX_WRITE="${SANDBOX_WRITE:+${SANDBOX_WRITE}:}${!x}"
+done
+unset x
+
 # sandbox's bashrc sources /etc/profile which unsets ROOTPATH,
 # so we have to back it up and restore it.
 if [ -n "${PORTAGE_ROOTPATH}" ] ; then
index a557d9fd9429cdaad323c72a8a46e8ee429e25b8..4f1ad1c6396cb6e1a669d961484aec6d4b8dc387 100755 (executable)
@@ -564,7 +564,7 @@ save_ebuild_env() {
                        PROFILE_PATHS PWORKDIR QA_INTERCEPTORS \
                        RC_DEFAULT_INDENT RC_DOT_PATTERN RC_ENDCOL \
                        RC_INDENTATION READONLY_EBUILD_METADATA READONLY_PORTAGE_VARS \
-                       ROOT ROOTPATH RPMDIR STARTDIR TMP TMPDIR USE_EXPAND \
+                       ROOT ROOTPATH RPMDIR STARTDIR TEMP TMP TMPDIR USE_EXPAND \
                        WARN XARGS _RC_GET_KV_CACHE
 
                # user config variables
index 45e5407f8e4aacae9551995777bf4a899dd54b79..7b892a652db2a7e91a0bd409105b69910fb1dd77 100644 (file)
@@ -1432,6 +1432,11 @@ class config(object):
                "TERM", "TERMCAP", "USER",
        ]
 
+       # tempdir settings
+       _environ_whitelist += [
+               "TMPDIR", "TEMP", "TMP",
+       ]
+
        # other variables inherited from the calling environment
        _environ_whitelist += [
                "CVS_RSH", "ECHANGELOG_USER",