diff options
Diffstat (limited to 'pym/portage/__init__.py')
-rw-r--r-- | pym/portage/__init__.py | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index dde0aeadb..053e33b25 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -4057,12 +4057,25 @@ def spawn(mystring, mysettings, debug=0, free=0, droppriv=0, sesandbox=0, fakero if 1 not in fd_pipes or 2 not in fd_pipes: raise ValueError(fd_pipes) + got_pty, master_fd, slave_fd = \ + _create_pty_or_pipe(copy_term_size=fd_pipes[1]) + + if not got_pty and 'sesandbox' in mysettings.features \ + and mysettings.selinux_enabled(): + # With sesandbox, logging works through a pty but not through a + # normal pipe. So, disable logging if ptys are broken. + # See Bug #162404. + logfile = None + os.close(master_fd) + master_fd = None + os.close(slave_fd) + slave_fd = None + + if logfile: + fd_pipes.setdefault(0, sys.stdin.fileno()) fd_pipes_orig = fd_pipes.copy() - got_pty, master_fd, slave_fd = \ - _create_pty_or_pipe(copy_term_size=fd_pipes_orig[1]) - # We must set non-blocking mode before we close the slave_fd # since otherwise the fcntl call can fail on FreeBSD (the child # process might have already exited and closed slave_fd so we |