On 6/14/19 4:28 PM, Bruno Haible wrote:
> Tim Rühsen wrote:
>> Do you think it makes more sense to open a bug at busybox then ?
> 
> I don't think so. Execution of scripts without shebang is considered
> legacy. Quoting <https://en.wikipedia.org/wiki/Shebang_(Unix)> :
> 
>   "Note that, even in systems with full kernel support for the #! magic 
> number,
>    some scripts lacking interpreter directives (although usually still
>    requiring execute permission) are still runnable by virtue of the legacy
>    script handling of the Bourne shell, still present in many of its modern
>    descendants. Scripts are then interpreted by the user's default shell."
> 

Conversely, POSIX requires that execution by 'sh' is the expected
behavior when #! is missing, and that use of #! renders a script
non-portable:

https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_01
"The shell reads its input from a file (see sh), from the -c option or
from the system() and popen() functions defined in the System Interfaces
volume of POSIX.1-2017. If the first line of a file of shell commands
starts with the characters "#!", the results are unspecified."

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

Reply via email to