commit: 1314c345cacfce8a5cd6036d66da0b5ab65c6adb
Author: Eli Schwartz <eschwartz93 <AT> gmail <DOT> com>
AuthorDate: Thu Feb 22 20:40:26 2024 +0000
Commit: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> 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 <eschwartz93 <AT> gmail.com>
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> 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