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 2171715801B for ; Wed, 26 Jul 2023 07:58:37 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 62BDDE084E; Wed, 26 Jul 2023 07:58:36 +0000 (UTC) Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 4ECA1E084E for ; Wed, 26 Jul 2023 07:58:36 +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)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 6938E335D7C for ; Wed, 26 Jul 2023 07:58:35 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id F3FE0DD3 for ; Wed, 26 Jul 2023 07:58:33 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1690358310.3bba408e214ae27bdf924ba90ad4b0919a85f3c8.sam@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: lib/portage/util/ X-VCS-Repository: proj/portage X-VCS-Files: lib/portage/util/env_update.py X-VCS-Directories: lib/portage/util/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 3bba408e214ae27bdf924ba90ad4b0919a85f3c8 X-VCS-Branch: master Date: Wed, 26 Jul 2023 07:58:33 +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: 4d42f0d0-3fe1-4450-ac2c-3c7829c6df1a X-Archives-Hash: 1fb9fdefa70fcc6b5e6f6019148d1464 commit: 3bba408e214ae27bdf924ba90ad4b0919a85f3c8 Author: Sam James gentoo org> AuthorDate: Tue Jul 25 03:16:36 2023 +0000 Commit: Sam James gentoo org> CommitDate: Wed Jul 26 07:58:30 2023 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=3bba408e lib: env_update: port to subprocess os.system is a bit janky here, let's use subprocess so we're not injecting multiple commands. Thanks to mgorny for the suggestion. Bug: https://bugs.gentoo.org/910376 Signed-off-by: Sam James gentoo.org> lib/portage/util/env_update.py | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/lib/portage/util/env_update.py b/lib/portage/util/env_update.py index 5c2b2fdd5..a7015669e 100644 --- a/lib/portage/util/env_update.py +++ b/lib/portage/util/env_update.py @@ -6,7 +6,7 @@ __all__ = ["env_update"] import errno import glob import stat -import sys +import subprocess import time import portage @@ -364,18 +364,24 @@ def _env_update(makelinks, target_root, prev_mtimes, contents, env, writemsg_lev writemsg_level( _(">>> Regenerating %setc/ld.so.cache...\n") % (target_root,) ) - ret = os.system(f"cd / ; {ldconfig} -X -r '{target_root}'") + ret = subprocess.run( + [f"{ldconfig}", "-X", "-r", f"{target_root}"], cwd="/" + ).returncode elif ostype in ("FreeBSD", "DragonFly"): writemsg_level( _(">>> Regenerating %svar/run/ld-elf.so.hints...\n") % target_root ) - ret = os.system( - ( - "cd / ; %s -elf -i " - + "-f '%svar/run/ld-elf.so.hints' '%setc/ld.so.conf'" - ) - % (ldconfig, target_root, target_root) - ) + ret = subprocess.run( + [ + f"{ldconfig}", + "-elf", + "-i", + "-f", + f"{target_root}var/run/ld-elf.so.hints", + f"{target_root}etc/ld.so.conf", + ], + cwd="/", + ).returncode ret = os.waitstatus_to_exitcode(ret) if ret > 0: