aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Gilbert <floppym@gentoo.org>2024-08-12 21:14:14 -0400
committerMike Gilbert <floppym@gentoo.org>2024-08-14 10:43:09 -0400
commit892f5408a6ff1aa899cc62a10ec07af57001f5d0 (patch)
treefea6cc38c0410bd88e216edc1c2bdc9348499e83
parentSupport coroutine exitfuncs for non-main loops (diff)
downloadportage-892f5408a6ff1aa899cc62a10ec07af57001f5d0.tar.gz
portage-892f5408a6ff1aa899cc62a10ec07af57001f5d0.tar.bz2
portage-892f5408a6ff1aa899cc62a10ec07af57001f5d0.zip
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@gentoo.org>
-rwxr-xr-xbin/dispatch-conf30
1 files changed, 11 insertions, 19 deletions
diff --git a/bin/dispatch-conf b/bin/dispatch-conf
index 93164d909..2e7256243 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):