On Wed, 25 Jun 2025 at 10:57, David Laight <david.laight.li...@gmail.com> wrote: > > On Wed, 25 Jun 2025 07:11:30 +0300 > Nadav Tasher <tasherna...@gmail.com> wrote: > > > On Tue, Jun 24, 2025 at 02:35:58PM +0200, Csókás Bence wrote: > > > Hi, > > > > > > On 2025. 06. 14. 18:10, Nadav Tasher wrote: > > > > To improve applet execution coverage, get_shell_name() will return "sh" > > > > when applets are prefered and "sh" is defined as a shell applet. > > > > > > > > This allows for more applets to execute sub-applets when spawning > > > > shells. > > > > > > > > Signed-off-by: Nadav Tasher <tasherna...@gmail.com> > > > > > > Maybe it's just me, but why are we overriding all users' shell preferences > > > depending on a Kconfig option? Isn't there a better way? > > > > > > Bence > > > > > This is intentional, since it is the only way we can guarantee applets > > which call system() or execv(get_shell_name(), ...) execute a self-contained > > shell that honors the "prefer applets" Kconfig. > > > > We need to force this behaviour to guarentee that only applets will be > > executed, since get_shell_name() will result in ash or hush being used > > instead of /bin/sh or others. > > Why/how does this help?
self-contained means that everything is needed is inside a single binary + preferred-applets means that internals are those executed so /bin/sh is ignored > > /bin/sh can easily be ash, dash or bash (and probably others). > OTOH pw->pw_shell could be absolutely anything and might not understand > 'posix' shell syntax at all. > Perhaps the obvious example being csh. However, your questioning is useful because different shell can be defined ---ash--- CONFIG_SH_IS_ASH=y # CONFIG_SH_IS_HUSH is not set # CONFIG_SH_IS_NONE is not set CONFIG_SHELL_ASH=y CONFIG_SHELL_HUSH=y CONFIG_SH_IS_ASH=y ---hush--- # CONFIG_SH_IS_ASH is not set CONFIG_SH_IS_HUSH=y # CONFIG_SH_IS_NONE is not set CONFIG_SHELL_ASH=y CONFIG_SHELL_HUSH=y ---bash--- # CONFIG_SH_IS_ASH is not set # CONFIG_SH_IS_HUSH is not set CONFIG_SH_IS_NONE=y CONFIG_SHELL_ASH=y CONFIG_SHELL_HUSH=y CONFIG_BASH_IS_ASH=y So, unless returning "sh" does not implicitly solve this ambiguity in the proper way, a the shell should be chosen in order of command completeness #IF SHELL_ASH == y return "ash" #ELSE #IF SHELL_HUSH == y return "hush" #ELSE return "sh" #ENDIF #ENDIF Best regards, R- _______________________________________________ busybox mailing list busybox@busybox.net https://lists.busybox.net/mailman/listinfo/busybox