summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorHelmut Grohne <helmut@subdivi.de>2024-06-21 21:59:57 +0200
committerHelmut Grohne <helmut@subdivi.de>2024-06-21 21:59:57 +0200
commitd6696df84c0c25e597edb5aa58c863ef360213d3 (patch)
tree592b80f475e284cc88c9bfaead14ff94a18bbb9e /examples
parent42c659f30f8d13bc5b6bcbe9203e83a9efa2b2a8 (diff)
downloadpython-linuxnamespaces-d6696df84c0c25e597edb5aa58c863ef360213d3.tar.gz
unschroot: enable opening /dev/stdout
When stdout is an (unnamed) pipe, it usually has permission 0o644. Since we change uids, /dev/stdout cannot be opened unless we chmod it first. This causes some packages such as supervisor to fail to build.
Diffstat (limited to 'examples')
-rwxr-xr-xexamples/unschroot.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/examples/unschroot.py b/examples/unschroot.py
index b9d4923..47d2a3c 100755
--- a/examples/unschroot.py
+++ b/examples/unschroot.py
@@ -23,6 +23,7 @@ import pwd
import shutil
import signal
import socket
+import stat
import sys
import tempfile
import typing
@@ -210,6 +211,9 @@ def do_run_session(args: argparse.Namespace) -> None:
pidfd: int
if pid == 0:
mainsock.close()
+ for fd in (1, 2):
+ if stat.S_ISFIFO(os.fstat(fd).st_mode):
+ os.fchmod(fd, 0o666)
os.chdir(session.path)
ns = (
linuxnamespaces.CloneFlags.NEWUSER