From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 5B4D8158089 for ; Sun, 22 Oct 2023 20:58:50 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 8045E2BC013; Sun, 22 Oct 2023 20:58:49 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 5DABA2BC013 for ; Sun, 22 Oct 2023 20:58:49 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 1A45E335C52 for ; Sun, 22 Oct 2023 20:58:48 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 41784E88 for ; Sun, 22 Oct 2023 20:58:46 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <1698004700.0b9fbe389db3c3b9e625e1f5f526b3a921d2e0ce.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: lib/portage/dbapi/ X-VCS-Repository: proj/portage X-VCS-Files: lib/portage/dbapi/vartree.py X-VCS-Directories: lib/portage/dbapi/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 0b9fbe389db3c3b9e625e1f5f526b3a921d2e0ce X-VCS-Branch: master Date: Sun, 22 Oct 2023 20:58:46 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 1d8d5d0f-ff6e-4507-8cfc-5c09e62e9d56 X-Archives-Hash: aeb3fb9b3ed0415f520adedb98eb410a commit: 0b9fbe389db3c3b9e625e1f5f526b3a921d2e0ce Author: Zac Medico gentoo org> AuthorDate: Sun Oct 22 19:57:16 2023 +0000 Commit: Zac Medico gentoo org> CommitDate: Sun Oct 22 19:58:20 2023 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=0b9fbe38 vardbapi.unpack_contents: Use multiprocessing.Pipe for spawn compat Bug: https://bugs.gentoo.org/916112 Signed-off-by: Zac Medico gentoo.org> lib/portage/dbapi/vartree.py | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/lib/portage/dbapi/vartree.py b/lib/portage/dbapi/vartree.py index a80d3bc0e3..5638935606 100644 --- a/lib/portage/dbapi/vartree.py +++ b/lib/portage/dbapi/vartree.py @@ -101,6 +101,7 @@ import grp import io from itertools import chain import logging +import multiprocessing import os as _os import operator import pickle @@ -1094,19 +1095,18 @@ class vardbapi(dbapi): ) if binpkg_format == "xpak": tar_cmd = ("tar", "-x", "--xattrs", "--xattrs-include=*", "-C", dest_dir) - pr, pw = os.pipe() + pr, pw = multiprocessing.Pipe(duplex=False) proc = await asyncio.create_subprocess_exec(*tar_cmd, stdin=pr) - os.close(pr) - with os.fdopen(pw, "wb", 0) as pw_file: - excluded_config_files = await loop.run_in_executor( - ForkExecutor(loop=loop), - functools.partial( - self._dblink(cpv).quickpkg, - pw_file, - include_config=opts.include_config == "y", - include_unmodified_config=opts.include_unmodified_config == "y", - ), - ) + pr.close() + excluded_config_files = await loop.run_in_executor( + ForkExecutor(loop=loop), + functools.partial( + self._dblink(cpv).quickpkg, + pw, + include_config=opts.include_config == "y", + include_unmodified_config=opts.include_unmodified_config == "y", + ), + ) await proc.wait() if proc.returncode != os.EX_OK: raise PortageException(f"command failed: {tar_cmd}") @@ -2161,7 +2161,9 @@ class dblink: # The tarfile module will write pax headers holding the # xattrs only if PAX_FORMAT is specified here. with tarfile.open( - fileobj=output_file, + fileobj=output_file + if hasattr(output_file, "write") + else open(output_file.fileno(), mode="wb", closefd=False), mode="w|", format=tarfile.PAX_FORMAT if xattrs else tarfile.DEFAULT_FORMAT, ) as tar: