Autodetect if sandbox is active in order to prevent recursive sandbox invocation...
authorZac Medico <zmedico@gentoo.org>
Thu, 21 Jun 2007 20:36:22 +0000 (20:36 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 21 Jun 2007 20:36:22 +0000 (20:36 -0000)
svn path=/main/trunk/; revision=6917

pym/portage/__init__.py
pym/portage/tests/ebuild/test_spawn.py

index d6afb9d9ddf39ceb918147df7741df6a8882bf2f..bf66dc4d2f008bb94414cc6d71b374ac89c24b1c 100644 (file)
@@ -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:
index c694566f218056fc376192b94354f95c85373a89..66e8f9ea7d8ff14e8c756e0fc1352e474a598566 100644 (file)
@@ -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()