Code Monkey home page Code Monkey logo

Comments (11)

oliverkwebb avatar oliverkwebb commented on August 24, 2024

relevant

from toybox.

landley avatar landley commented on August 24, 2024

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.

from toybox.

xplshn avatar xplshn commented on August 24, 2024

Because not all people have installed bash at /bin/bash. And an error message that reads: make: scripts/genconfig.sh: No such file or directory when scripts/genconfig.sh DOES indeed exist is not quite useful for such people (me including).

/usr/bin/env should be used if you want to run under bash because env will lookup bash in the user's $PATH and run it.

For example, I have bash under ~/.local/bin because my package manager (bigdl) installed it there when I ran it as a user.

from toybox.

landley avatar landley commented on August 24, 2024

If /bin/bash can't be trusted to be at that location, why would /usr/bin/env be any different?

from toybox.

oliverkwebb avatar oliverkwebb commented on August 24, 2024

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
bash scripts/make.sh either directly or telling the makefile to do it would work I think.

from toybox.

enh-google avatar enh-google commented on August 24, 2024

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?".

from toybox.

oliverkwebb avatar oliverkwebb commented on August 24, 2024

from toybox.

xplshn avatar xplshn commented on August 24, 2024

env is a pretty standard POSIX utility that’s on most-everything that runs UNIX, bash is not

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/*

from toybox.

oliverkwebb avatar oliverkwebb commented on August 24, 2024

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

from toybox.

xplshn avatar xplshn commented on August 24, 2024

Its the same. However, it is better to fix the scripts shebang instead of modifying the Makefile to call them with bash.

from toybox.

tpimh avatar tpimh commented on August 24, 2024

See previous discussion here: #77

from toybox.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.