From 1314c345cacfce8a5cd6036d66da0b5ab65c6adb Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Thu, 22 Feb 2024 15:40:26 -0500 Subject: avoid chrooting and running the $PATH to bash from outside the chroot MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Andreas K. Hüttel --- 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 -- cgit v1.2.3-65-gdbad