From d6696df84c0c25e597edb5aa58c863ef360213d3 Mon Sep 17 00:00:00 2001 From: Helmut Grohne Date: Fri, 21 Jun 2024 21:59:57 +0200 Subject: 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. --- examples/unschroot.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'examples') 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 -- cgit v1.2.3