Make the overlayfs mount point's owners and modes match the underlay.

This fixes sudo in the chroot.
This commit is contained in:
Andrew Hamilton 2016-02-10 22:33:49 +00:00
parent 1939d1eda2
commit 964243ffb8
3 changed files with 6 additions and 1 deletions

1
BUGS
View file

@ -1,5 +1,6 @@
Current
- Within the sandbox sudo is not working for tools.
<- Sudo is working now but its always asking for a password.
- If a tool runs a script that needs sudo, the password prompt is garbling
the screen and stopping input.
- When paging the summary window, with the bottom scroll bar showing, the

View file

@ -20,6 +20,9 @@ class OverlayfsMount():
subprocess.check_call(["sudo", "mount", "-t", "overlayfs", "-o",
option_string, "overlayfs", self.mount_point],
stderr=subprocess.PIPE)
for command in ["chmod", "chown"]:
subprocess.check_call(["sudo", command, "--reference", lower_dir,
mount_point])
def __repr__(self):
return "<OverlayfsMount:%r over %r>" % (self.mount_point,

View file

@ -4,6 +4,7 @@
# Licensed under the Artistic License 2.0.
import os
import subprocess
import tempfile
import unittest
@ -23,7 +24,7 @@ class SandboxFilesystemTestCase(unittest.TestCase):
def test_sandbox_minimal(self):
foo_upper_path = os.path.join(self.sandbox.mount_point, "foo")
open(foo_upper_path, "w").close()
subprocess.check_call(["sudo", "touch", foo_upper_path])
self.assertTrue(os.path.exists(foo_upper_path))
foo_lower_path = os.path.join(self.sandbox.overlay_mounts[0].lower_dir,
"foo")