-
Notifications
You must be signed in to change notification settings - Fork 501
Description
Hi,
Following the discussion with @fredizzimo in #651, I think that it is best to discuss how to tackle the exported binaries.
First of all, let me write down the goal (in my opinion) that we should strive for with binaries export:
"Exported binaries should produce the same result than the same command run from inside the distrobox"
To reach this goal, I suggest using a login shell by default, as not using it may only cause hard to debug issues, with no clear advantage.
I would also argue that using a login shell and executing the command within that also solve an issue raised in the original merge request: in what shell should the command be run?
There are three level to this:
- What shell interprets the arguments given? (globbing, etc) -> the shell from which the exported binary is called
- What shell actually executes the exported binary? -> ??
- What is the $SHELL present while executing the exported binary? -> the default shell set inside the distrobox
I would argue that number 2 is not actually important, as no matter the shell, the end result should be the same.
This allows us to use a single shell for all use case inside the exported script. This is a big advantage over using $SHELL, as it allows us to avoid having to determine what syntax should be used (e.g: fish does not use $@).
Being careful avoiding issues with binary files that may not be executed with a simple sh -l myBinaryFile, we would get a end result along the lines of:
distrobox-enter ${rootful} -n myDistrobox -- ${is_sudo} sh -lc 'path/to/command "$@"' command ${extra_flags} "$@"
I will most likely submit a merge request for this, do not hesitate to let me hear your thoughts.