You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by ro...@apache.org on 2020/12/29 13:41:14 UTC

[buildstream] 01/02: sandbox/_sandboxbwrap.py: Bind mount /etc/passwd for bst shell

This is an automated email from the ASF dual-hosted git repository.

root pushed a commit to branch juerg/gnome
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 66956d2065cb1ca9ff2aca2fcb2d558f12365ea4
Author: Jürg Billeter <j...@bitron.ch>
AuthorDate: Thu Feb 8 08:56:56 2018 +0100

    sandbox/_sandboxbwrap.py: Bind mount /etc/passwd for bst shell
---
 buildstream/sandbox/_sandboxbwrap.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/buildstream/sandbox/_sandboxbwrap.py b/buildstream/sandbox/_sandboxbwrap.py
index bb5bd1f..75250df 100644
--- a/buildstream/sandbox/_sandboxbwrap.py
+++ b/buildstream/sandbox/_sandboxbwrap.py
@@ -138,7 +138,10 @@ class SandboxBwrap(Sandbox):
         # Set UID and GUI
         if self.user_ns_available:
             bwrap_command += ['--unshare-user']
-            if not flags & SandboxFlags.INHERIT_UID:
+            if flags & SandboxFlags.INHERIT_UID:
+                bwrap_command += ['--ro-bind', '/etc/passwd', '/etc/passwd']
+                bwrap_command += ['--ro-bind', '/etc/group', '/etc/group']
+            else:
                 bwrap_command += ['--uid', '0', '--gid', '0']
 
         # Add the command