$ sandbox sh -c 'echo wtf' $ This happens because sandbox runs bash -c "sh -c echo wtf", and bash can no longer see that "echo wtf" was supposed to be a single argument. I'm testing a patch, if it works I'll attach it, if not I'll let you know.
Created attachment 188156 [details, diff] sandbox-args.patch $ sandbox sh -c 'echo wtf' wtf $ Or you could make run_str an array if you prefer.
Oi... portage is relying on the current behaviour. Is that intentional?
Created attachment 188159 [details, diff] portage-2.2-sandbox.patch Not that modifying portage (the quick-and-dirty way) is that hard, but I suppose if you fix this, you'll have a very hard time making sure there's a clean upgrade path. Any thoughts?
sandbox sh -c '"echo wtf"'
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=9a026d957ffc18ab4f4f7d069f4373ddf190eca9 commit 9a026d957ffc18ab4f4f7d069f4373ddf190eca9 Author: Mike Frysinger <vapier@gentoo.org> AuthorDate: 2021-10-29 03:50:00 +0000 Commit: Mike Frysinger <vapier@gentoo.org> CommitDate: 2021-10-29 03:50:00 +0000 sandbox: change interface to make it easier to pass thru The sandbox command line is passed to a shell for execution. This can be a bit awkward to quote right if you weren't expecting it, and even if you were. Change the default behavior to be more like `env` where the arguments, as they are, get passed through and run. If people want the old shell behavior, they can use the -c option akin to `bash -c`. Bug: https://bugs.gentoo.org/265907 Signed-off-by: Mike Frysinger <vapier@gentoo.org> src/options.c | 8 +++++++- src/sandbox.c | 46 +++++++++++++++++++++++++++------------------- src/sandbox.h | 1 + tests/git-bisector.sh | 15 +++++++++++++-- tests/local.at | 2 +- 5 files changed, 49 insertions(+), 23 deletions(-)
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=116ca8fd5af908edad85095916585576aa19ec5f commit 116ca8fd5af908edad85095916585576aa19ec5f Author: Mike Frysinger <vapier@gentoo.org> AuthorDate: 2021-11-02 04:13:53 +0000 Commit: Mike Frysinger <vapier@gentoo.org> CommitDate: 2021-11-02 04:13:53 +0000 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 <vapier@gentoo.org> src/sandbox.c | 9 +++++++++ 1 file changed, 9 insertions(+)