From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1661603-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id 308BC159C9B
	for <garchives@archives.gentoo.org>; Wed, 14 Aug 2024 14:44:06 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 3FED9E29F9;
	Wed, 14 Aug 2024 14:44:04 +0000 (UTC)
Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 1F7F6E29F9
	for <gentoo-commits@lists.gentoo.org>; Wed, 14 Aug 2024 14:44:04 +0000 (UTC)
Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 1A94233DF47
	for <gentoo-commits@lists.gentoo.org>; Wed, 14 Aug 2024 14:44:03 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 7C7141C57
	for <gentoo-commits@lists.gentoo.org>; Wed, 14 Aug 2024 14:44:01 +0000 (UTC)
From: "Mike Gilbert" <floppym@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Mike Gilbert" <floppym@gentoo.org>
Message-ID: <1723646589.892f5408a6ff1aa899cc62a10ec07af57001f5d0.floppym@gentoo>
Subject: [gentoo-commits] proj/portage:master commit in: bin/
X-VCS-Repository: proj/portage
X-VCS-Files: bin/dispatch-conf
X-VCS-Directories: bin/
X-VCS-Committer: floppym
X-VCS-Committer-Name: Mike Gilbert
X-VCS-Revision: 892f5408a6ff1aa899cc62a10ec07af57001f5d0
X-VCS-Branch: master
Date: Wed, 14 Aug 2024 14:44:01 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: 3555cc07-65e2-4b87-8281-5ea9a79e4ff9
X-Archives-Hash: 1f8e3d12942da5fb8f38d6b22d1d25cb

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):