summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-06-21 20:36:22 +0000
committerZac Medico <zmedico@gentoo.org>2007-06-21 20:36:22 +0000
commit50dc22b8f85c5b1b5911a200f0b74257ed962461 (patch)
tree92679ca8515d97a0ad6cf7d19f46bcfe57edbab8
parent6fc552f3e3e4d39a609a86b8220589382c922e0d (diff)
downloadportage-50dc22b8f85c5b1b5911a200f0b74257ed962461.tar.gz
portage-50dc22b8f85c5b1b5911a200f0b74257ed962461.tar.bz2
portage-50dc22b8f85c5b1b5911a200f0b74257ed962461.zip
Autodetect if sandbox is active in order to prevent recursive sandbox invocation. Thanks to Brian Harring for the suggestion.
svn path=/main/trunk/; revision=6917
-rw-r--r--pym/portage/__init__.py2
-rw-r--r--pym/portage/tests/ebuild/test_spawn.py4
2 files changed, 2 insertions, 4 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index d6afb9d9d..bf66dc4d2 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -2423,7 +2423,7 @@ def spawn(mystring, mysettings, debug=0, free=0, droppriv=0, sesandbox=0, **keyw
(not droppriv and "sandbox" not in features and \
"usersandbox" not in features))
- if free:
+ if free or "SANDBOX_ACTIVE" in os.environ:
keywords["opt_name"] += " bash"
spawn_func = portage.process.spawn_bash
else:
diff --git a/pym/portage/tests/ebuild/test_spawn.py b/pym/portage/tests/ebuild/test_spawn.py
index c694566f2..66e8f9ea7 100644
--- a/pym/portage/tests/ebuild/test_spawn.py
+++ b/pym/portage/tests/ebuild/test_spawn.py
@@ -16,10 +16,8 @@ class SpawnTestCase(TestCase):
os.close(fd)
null_fd = os.open('/dev/null', os.O_RDWR)
test_string = 2 * "blah blah blah\n"
- # use free=1 to disable sandbox so that this test can run inside a
- # sandbox (sandbox in sandbox is not currently allowed)
spawn("echo -n '%s'" % test_string, settings, logfile=logfile,
- free=1, fd_pipes={0:sys.stdin.fileno(), 1:null_fd, 2:null_fd})
+ fd_pipes={0:sys.stdin.fileno(), 1:null_fd, 2:null_fd})
os.close(null_fd)
f = open(logfile, 'r')
log_content = f.read()