Bug 15371 - env in shebang won't accept more than 1 parameter
Summary: env in shebang won't accept more than 1 parameter
Status: NEW
Alias: None
Product: Busybox
Classification: Unclassified
Component: Other (show other bugs)
Version: unspecified
Hardware: All Linux
: P5 enhancement
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-03-06 02:45 UTC by Marius Dinu
Modified: 2023-03-06 02:45 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marius Dinu 2023-03-06 02:45:55 UTC
Busybox v1.36.0

When script interpreter path is unknown, it is common to use env as a "preloader" in the shebang:

#!/bin/env -S <interpreter_without_path> <parameters>

Busybox env does not support -S parameter. Without -S, tries to execute [interpreter and it's parameters] as a single filename.
Example:

Script starts with "#!/bin/env awk -f":

execve("/usr/sbin/awk -f", ["awk -f", "/bin/ipcalc.sh"], 0xbe806d84 /* 16 vars */) = -1 ENOENT (No such file or directory)
execve("/usr/bin/awk -f", ["awk -f", "/bin/ipcalc.sh"], 0xbe806d84 /* 16 vars */) = -1 ENOENT (No such file or directory)
execve("/sbin/awk -f", ["awk -f", "/bin/ipcalc.sh"], 0xbe806d84 /* 16 vars */) = -1 ENOENT (No such file or directory)
execve("/bin/awk -f", ["awk -f", "/bin/ipcalc.sh"], 0xbe806d84 /* 16 vars */) = -1 ENOENT (No such file or directory)

Please add -S parameter to env.
Thank you.