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 58B9F158041 for ; Sun, 3 Mar 2024 18:51:02 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 5DC87E2A1F; Sun, 3 Mar 2024 18:51:01 +0000 (UTC) Received: from smtp.gentoo.org (dev.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) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 106FEE2A1F for ; Sun, 3 Mar 2024 18:51:01 +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 2DC3833F9FD for ; Sun, 3 Mar 2024 18:51:00 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 87DDBE95 for ; Sun, 3 Mar 2024 18:50:58 +0000 (UTC) From: "Andreas K. Hüttel" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Andreas K. Hüttel" Message-ID: <1709491845.1314c345cacfce8a5cd6036d66da0b5ab65c6adb.dilfridge@gentoo> Subject: [gentoo-commits] proj/catalyst:master commit in: catalyst/base/ X-VCS-Repository: proj/catalyst X-VCS-Files: catalyst/base/stagebase.py X-VCS-Directories: catalyst/base/ X-VCS-Committer: dilfridge X-VCS-Committer-Name: Andreas K. Hüttel X-VCS-Revision: 1314c345cacfce8a5cd6036d66da0b5ab65c6adb X-VCS-Branch: master Date: Sun, 3 Mar 2024 18:50:58 +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: d5128620-bdf5-40f9-84ee-f64df034827f X-Archives-Hash: e7c958d8a45930e07a13bcd710efa914 commit: 1314c345cacfce8a5cd6036d66da0b5ab65c6adb Author: Eli Schwartz gmail com> AuthorDate: Thu Feb 22 20:40:26 2024 +0000 Commit: Andreas K. Hüttel gentoo org> CommitDate: Sun Mar 3 18:50:45 2024 +0000 URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=1314c345 avoid chrooting and running the $PATH to bash from outside the chroot The API filename for bash is /bin/bash and that is where it is guaranteed to be. On merged-usr systems, `shutil.which('bash')` will search PATH and maybe find /usr/bin/bash first, since it is resolved as a symlink, but that path will then fail in the chroot if the chroot is not merged-usr. Even on merged-usr systems, app-shells/bash always, always, always installs to /bin/bash and lets portage handle the symlink. Signed-off-by: Eli Schwartz gmail.com> Signed-off-by: Andreas K. Hüttel gentoo.org> catalyst/base/stagebase.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py index dd00af45..4bcab30c 100644 --- a/catalyst/base/stagebase.py +++ b/catalyst/base/stagebase.py @@ -1458,11 +1458,12 @@ class StageBase(TargetBase, ClearBase, GenBase): def enter_chroot(self): chroot = command('chroot') - bash = command('bash') + # verify existence only + command(os.path.join(self.settings['chroot_path'], '/bin/bash')) log.notice("Entering chroot") try: - cmd([chroot, self.settings['chroot_path'], bash, '-l'], + cmd([chroot, self.settings['chroot_path'], '/bin/bash', '-l'], env=self.env) except CatalystError: pass