-
Notifications
You must be signed in to change notification settings - Fork 340
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Most scripts use /bin/bash, which not all systems have. Use /usr/bin/env instead? #494
Comments
If /bin/bash isn't a reliable absolute path, why would /usr/bin/env be a reliable absolute path? Toybox has scripts/prereq/build.sh to produce prerequisite commands in a portable way (commit 3bbc31c has an example invocation used to build toybox outside homebrew on macos, for example). It doesn't include toysh yet because it's still in pending, but once that's promoted it should include that and you should be able to "sh scripts/make.sh". There's a planned rewrite/replacement of kconfig that should also allow .config file generation to run portably. It's not finished yet, but that's the plan. |
Because not all people have installed bash at /bin/bash. And an error message that reads: /usr/bin/env should be used if you want to run under For example, I have bash under |
If /bin/bash can't be trusted to be at that location, why would /usr/bin/env be any different? |
Because env searches your path, doing a direct /bin/bash does not, doing |
his point is "if |
On Mon, Apr 15, 2024 at 14:25, enh-google ***@***.***(mailto:On Mon, Apr 15, 2024 at 14:25, enh-google <<a href=)> wrote:
> Because env searches your path, doing a direct /bin/bash does not, doing
his point is "if /bin/bash isn't there, what reason do i have to assume /usr/bin/env exists?".
env is a pretty standard POSIX utility that’s on most-everything that runs UNIX, bash is not
… —
Reply to this email directly, [view it on GitHub](#494 (comment)), or [unsubscribe](https://github.com/notifications/unsubscribe-auth/A5GSADP2223AWC7T45CRDJDY5QSTPAVCNFSM6AAAAABGFV5K7SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANJXGY2DMNJVHE).
You are receiving this because you commented.Message ID: ***@***.***>
|
Absolutely! But that's not the problem, since Landley wants to use Bash syntax, the only problem is that some people may have bash installed in other directories. For example; I wouldn't install software such as Bash into my system, instead, I put such software under ~/.local/bin or /opt/compat/* |
The solution is to tell your makefile to run a scriptwith bash (Searches path) instead of calling the shebang. The following diff fixes this: @@ -14,7 +14,7 @@ all: toybox
KCONFIG_CONFIG ?= .config
toybox generated/unstripped/toybox: $(KCONFIG_CONFIG) *.[ch] lib/*.[ch] toys/*/*.c scripts/*.sh Config.in
- scripts/make.sh
+ bash scripts/make.sh
.PHONY: clean distclean baseline bloatcheck install install_flat \
uninstall uninstall_flat tests help change \
@@ -32,7 +32,7 @@ $(KCONFIG_CONFIG): $(KCONFIG_TOP)
$(KCONFIG_TOP): generated/Config.in generated/Config.probed
generated/Config.probed: generated/Config.in
generated/Config.in: toys/*/*.c scripts/genconfig.sh
- scripts/genconfig.sh
+ bash scripts/genconfig.sh
# Development targets
baseline: generated/unstripped/toybox |
Its the same. However, it is better to fix the scripts shebang instead of modifying the Makefile to call them with |
See previous discussion here: #77 |
Possible fixes:
Use /usr/bin/env bash
Do not use GNU things
Else, toybox can't be build on systems without bash, like Alpine, obviously it would be trivial to install bash but reducing dependencies (on non-POSIX things) would be great.
The text was updated successfully, but these errors were encountered: