From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 9E6BA158086 for ; Tue, 2 Nov 2021 04:28:21 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id EBE05E0891; Tue, 2 Nov 2021 04:28:20 +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)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 4AEB2E0891 for ; Tue, 2 Nov 2021 04:28:19 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id F232B342DE3 for ; Tue, 2 Nov 2021 04:28:18 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 82A11186 for ; Tue, 2 Nov 2021 04:28:17 +0000 (UTC) From: "Mike Frysinger" 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 Frysinger" Message-ID: <1635826433.116ca8fd5af908edad85095916585576aa19ec5f.vapier@gentoo> Subject: [gentoo-commits] proj/sandbox:master commit in: src/ X-VCS-Repository: proj/sandbox X-VCS-Files: src/sandbox.c X-VCS-Directories: src/ X-VCS-Committer: vapier X-VCS-Committer-Name: Mike Frysinger X-VCS-Revision: 116ca8fd5af908edad85095916585576aa19ec5f X-VCS-Branch: master Date: Tue, 2 Nov 2021 04:28:17 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 6135c271-8090-4aab-959d-636b3e5a66c0 X-Archives-Hash: 67dc36e07fe4be7d9483197d80d02177 commit: 116ca8fd5af908edad85095916585576aa19ec5f Author: Mike Frysinger gentoo org> AuthorDate: Tue Nov 2 04:13:53 2021 +0000 Commit: Mike Frysinger gentoo org> CommitDate: Tue Nov 2 04:13:53 2021 +0000 URL: https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=116ca8fd sandbox: add backwards compat interface hack Portage runs commands through sandbox like: $ sandbox "/usr/lib/portage/python3.9/ebuild.sh unpack" That means we can't break the CLI without breaking portage and forcing everyone to upgrade together. That'll be pretty disruptive for people, so add a hack to detect this situation: if a single argument is passed on the CLI, and it doesn't appear to be a file, then fallback to running it through the shell. This keeps portage working while allowing the new interface style to launch. If/when we can update portage to always use the -c option, maybe we can drop this in the future. Or not ... it's not exactly the worst hack for users. Bug: https://bugs.gentoo.org/265907 Signed-off-by: Mike Frysinger gentoo.org> src/sandbox.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/sandbox.c b/src/sandbox.c index 2d03dd4..ed0c7f6 100644 --- a/src/sandbox.c +++ b/src/sandbox.c @@ -260,6 +260,15 @@ int main(int argc, char **argv) goto oom_error; /* Setup bash argv */ + if (!opt_use_bash && argc == 2) { + /* Backwards compatibility hack: if there's only one argument, and it + * appears to be a shell command (not an absolute path to a program), + * then fallback to running through the shell. + */ + if (access(argv[1], X_OK)) + opt_use_bash = true; + } + if (opt_use_bash || argc == 1) { str_list_add_item_copy(argv_bash, "/bin/bash", oom_error); str_list_add_item_copy(argv_bash, "-rcfile", oom_error);