diff options
author | Zac Medico <zmedico@gentoo.org> | 2009-12-05 23:00:55 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2009-12-05 23:00:55 +0000 |
commit | 879e2a33ff07dac1df442ca790ae80078c6e9631 (patch) | |
tree | bc9585999959897ba3098643711eeed976da9304 /pym/_emerge | |
parent | 731b3a807b3f69b6b8783459f8fb00dd2a8a179b (diff) | |
download | portage-879e2a33ff07dac1df442ca790ae80078c6e9631.tar.gz portage-879e2a33ff07dac1df442ca790ae80078c6e9631.tar.bz2 portage-879e2a33ff07dac1df442ca790ae80078c6e9631.zip |
Bug #162404 - Automatically disable logging if sesandbox is enabled and a
pty is not available for some reason (currently they are never available
with python3).
svn path=/main/trunk/; revision=14928
Diffstat (limited to 'pym/_emerge')
-rw-r--r-- | pym/_emerge/EbuildProcess.py | 7 | ||||
-rw-r--r-- | pym/_emerge/SpawnProcess.py | 8 |
2 files changed, 14 insertions, 1 deletions
diff --git a/pym/_emerge/EbuildProcess.py b/pym/_emerge/EbuildProcess.py index 86a63282f..a6a0b362b 100644 --- a/pym/_emerge/EbuildProcess.py +++ b/pym/_emerge/EbuildProcess.py @@ -24,6 +24,13 @@ class EbuildProcess(SpawnProcess): portage._create_pty_or_pipe(copy_term_size=stdout_pipe) return (master_fd, slave_fd) + def _can_log(self, slave_fd): + # With sesandbox, logging works through a pty but not through a + # normal pipe. So, disable logging if ptys are broken. + # See Bug #162404. + return not ('sesandbox' in self.settings.features \ + and self.settings.selinux_enabled()) or os.isatty(slave_fd) + def _spawn(self, args, **kwargs): root_config = self.pkg.root_config diff --git a/pym/_emerge/SpawnProcess.py b/pym/_emerge/SpawnProcess.py index 1486e6773..67fb17e29 100644 --- a/pym/_emerge/SpawnProcess.py +++ b/pym/_emerge/SpawnProcess.py @@ -49,7 +49,6 @@ class SpawnProcess(SubProcess): if fd == sys.stderr.fileno(): sys.stderr.flush() - logfile = self.logfile self._files = self._files_dict() files = self._files @@ -57,6 +56,10 @@ class SpawnProcess(SubProcess): fcntl.fcntl(master_fd, fcntl.F_SETFL, fcntl.fcntl(master_fd, fcntl.F_GETFL) | os.O_NONBLOCK) + logfile = None + if self._can_log(slave_fd): + logfile = self.logfile + null_input = None fd_pipes_orig = fd_pipes.copy() if self.background: @@ -125,6 +128,9 @@ class SpawnProcess(SubProcess): self.pid = retval[0] portage.process.spawned_pids.remove(self.pid) + def _can_log(self, slave_fd): + return True + def _pipe(self, fd_pipes): """ @type fd_pipes: dict |