Skip to content

Commit

Permalink
dispatch-conf: ignore SHELL in spawn_shell
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
floppym committed Aug 13, 2024
1 parent 819c863 commit 09f0539
Showing 1 changed file with 11 additions and 19 deletions.
30 changes: 11 additions & 19 deletions bin/dispatch-conf
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 09f0539

Please sign in to comment.