commit: 892f5408a6ff1aa899cc62a10ec07af57001f5d0 Author: Mike Gilbert <floppym <AT> gentoo <DOT> org> AuthorDate: Tue Aug 13 01:14:14 2024 +0000 Commit: Mike Gilbert <floppym <AT> gentoo <DOT> org> CommitDate: Wed Aug 14 14:43:09 2024 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=892f5408
dispatch-conf: ignore SHELL in spawn_shell There is no need to use SHELL here, and this can actually cause problems when SHELL is set to "nologin" or "false". Look for sh in PATH instead. Bug: https://bugs.gentoo.org/910560 Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org> bin/dispatch-conf | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/bin/dispatch-conf b/bin/dispatch-conf index 93164d909e..2e72562439 100755 --- a/bin/dispatch-conf +++ b/bin/dispatch-conf @@ -574,26 +574,18 @@ def clear_screen(): os.system("clear 2>/dev/null") -shell = os.environ.get("SHELL") -if not shell or not os.access(shell, os.EX_OK): - shell = find_binary("sh") - - def spawn_shell(cmd): - if shell: - sys.__stdout__.flush() - sys.__stderr__.flush() - spawn( - [shell, "-c", cmd], - env=os.environ, - fd_pipes={ - 0: portage._get_stdin().fileno(), - 1: sys.__stdout__.fileno(), - 2: sys.__stderr__.fileno(), - }, - ) - else: - os.system(cmd) + sys.__stdout__.flush() + sys.__stderr__.flush() + spawn( + ["sh", "-c", cmd], + env=os.environ, + fd_pipes={ + 0: portage._get_stdin().fileno(), + 1: sys.__stdout__.fileno(), + 2: sys.__stderr__.fileno(), + }, + ) def usage(argv):
