commit: b9e30bb50996c11f2b046a9c6eb47ba8dc6331e6 Author: Sheng Yu <syu.os <AT> protonmail <DOT> com> AuthorDate: Wed Nov 2 17:52:18 2022 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Wed Nov 2 22:58:49 2022 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=b9e30bb5
Do not redirect stderr from gpkg subprocess Closes: https://bugs.gentoo.org/877215 Signed-off-by: Sheng Yu <syu.os <AT> protonmail.com> Closes: https://github.com/gentoo/portage/pull/927 Signed-off-by: Sam James <sam <AT> gentoo.org> lib/portage/gpkg.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/lib/portage/gpkg.py b/lib/portage/gpkg.py index 3d2aa4223..561fa4450 100644 --- a/lib/portage/gpkg.py +++ b/lib/portage/gpkg.py @@ -92,6 +92,7 @@ class tar_stream_writer: gid # drop root group to gid """ self.checksum_helper = checksum_helper + self.cmd = cmd self.closed = False self.container = container self.killed = False @@ -124,7 +125,6 @@ class tar_stream_writer: cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, - stderr=subprocess.PIPE, user=self.uid, group=self.gid, ) @@ -133,7 +133,6 @@ class tar_stream_writer: cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, - stderr=subprocess.PIPE, preexec_fn=self._drop_privileges, ) @@ -195,10 +194,10 @@ class tar_stream_writer: buffer = self.proc.stdout.read(HASHING_BLOCKSIZE) if not buffer: self.proc.stdout.close() - self.proc.stderr.close() return except BrokenPipeError: self.proc.stdout.close() + writemsg(colorize("BAD", f"GPKG subprocess failed: {self.cmd} \n")) if not self.killed: # Do not raise error if killed by portage raise CompressorOperationFailed("PIPE broken") @@ -220,6 +219,7 @@ class tar_stream_writer: self.proc.stdin.write(data) except BrokenPipeError: self.error = True + writemsg(colorize("BAD", f"GPKG subprocess failed: {self.cmd} \n")) raise CompressorOperationFailed("PIPE broken") else: # Write to container @@ -319,7 +319,6 @@ class tar_stream_reader: cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, - stderr=subprocess.PIPE, user=self.uid, group=self.gid, ) @@ -328,7 +327,6 @@ class tar_stream_reader: cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, - stderr=subprocess.PIPE, preexec_fn=self._drop_privileges, ) self.read_io = self.proc.stdout @@ -374,6 +372,7 @@ class tar_stream_reader: break except BrokenPipeError: if self.killed is False: + writemsg(colorize("BAD", f"GPKG subprocess failed: {self.cmd} \n")) raise CompressorOperationFailed("PIPE broken") def _drop_privileges(self): @@ -431,14 +430,11 @@ class tar_stream_reader: self.thread.join() try: if self.proc.wait() != os.EX_OK: - if not self.proc.stderr.closed: - stderr = self.proc.stderr.read().decode() if not self.killed: - writemsg(colorize("BAD", f"!!!\n{stderr}")) + writemsg(colorize("BAD", f"GPKG external program failed.")) raise CompressorOperationFailed("decompression failed") finally: self.proc.stdout.close() - self.proc.stderr.close() class checksum_helper: