Bug #190268 - Avoid unwanted sandbox violations in src_test().
authorZac Medico <zmedico@gentoo.org>
Sat, 8 Sep 2007 07:01:39 +0000 (07:01 -0000)
committerZac Medico <zmedico@gentoo.org>
Sat, 8 Sep 2007 07:01:39 +0000 (07:01 -0000)
  - Allow SANDBOX_* variables to pass through.
  - Don't try to create an sandbox instance inside a test case in order to
    interaction with SANDBOX_* variables in src_test(). (trunk r7759)

svn path=/main/branches/2.1.2/; revision=7760

pym/portage.py
tests/portage/test_spawn.py

index a4fb9a9e59222e8edc88112c3ec718716b5cd254..28e54af7b908d568ee039a5dad255535fa599e50 100644 (file)
@@ -1313,8 +1313,7 @@ class config:
 
                        # Blacklist vars that could interfere with portage internals.
                        for blacklisted in "CATEGORY", "PKGUSE", "PORTAGE_CONFIGROOT", \
-                               "ROOT", "SANDBOX_DENY", "SANDBOX_PREDICT", "SANDBOX_READ", \
-                               "SANDBOX_WRITE":
+                               "ROOT":
                                for cfg in self.lookuplist:
                                        cfg.pop(blacklisted, None)
                        del blacklisted, cfg
index a2a2571c7e9b49e3569c6af267700d584b4131b4..5a80106211e68f2c6c405dbd8efd6f1f8bdf478f 100644 (file)
@@ -16,8 +16,16 @@ class SpawnTestCase(TestCase):
                        os.close(fd)
                        null_fd = os.open('/dev/null', os.O_RDWR)
                        test_string = 2 * "blah blah blah\n"
+                       # Test cases are unique because they run inside src_test() which
+                       # may or may not already be running within a sandbox. Interaction
+                       # with SANDBOX_* variables may trigger unwanted sandbox violations
+                       # that are only reproducible with certain combinations of sandbox,
+                       # usersandbox, and userpriv FEATURES. Attempts to filter SANDBOX_*
+                       # variables can interfere with a currently running sandbox
+                       # instance. Therefore, use free=1 here to avoid potential
+                       # interactions (see bug #190268).
                        spawn("echo -n '%s'" % test_string, settings, logfile=logfile,
-                               fd_pipes={0:sys.stdin.fileno(), 1:null_fd, 2:null_fd})
+                               free=1, fd_pipes={0:sys.stdin.fileno(), 1:null_fd, 2:null_fd})
                        os.close(null_fd)
                        f = open(logfile, 'r')
                        log_content = f.read()