On Tue, Dec 03, 2019 at 07:46:03AM +0100, Michael Olbrich wrote: > On Thu, Nov 28, 2019 at 12:19:44AM +0100, Florian Klink wrote: > > Some distributions might not have bash in /bin, but in $PATH. > > > > Using #!/usr/bin/env bash solves this, and is consistent with how the > > perl and python shebangs look like in the tree. > > --- > > scripts/canon-a1100-image | 2 +- > > scripts/check_size | 2 +- > > scripts/dfuboot.sh | 2 +- > > scripts/extract_symbol_offset | 2 +- > > scripts/gen-dtb-s | 2 +- > > scripts/genenv | 2 +- > > scripts/socfpga_get_sequencer | 2 +- > > scripts/socfpga_import_preloader | 2 +- > > scripts/socfpga_xml_to_config.sh | 2 +- > > 9 files changed, 9 insertions(+), 9 deletions(-) > > > > diff --git a/scripts/canon-a1100-image b/scripts/canon-a1100-image > > index 6c08d7493..237ce26d8 100755 > > --- a/scripts/canon-a1100-image > > +++ b/scripts/canon-a1100-image > > @@ -1,4 +1,4 @@ > > -#!/bin/bash -e > > +#!/usr/bin/env bash -e > > This does not work: > > /usr/bin/env: ‘bash -e’: No such file or directory > /usr/bin/env: use -[v]S to pass options in shebang lines > > Using '/usr/bin/env -S bash -e' works, but I'm not sure how portable that > is.
According to execve(2) , this behaviour is specific to Linux: The semantics of the optional-arg argument of an interpreter script vary across implementations. On Linux, the entire string following the interpreter name is passed as a single argument to the interpreter, and this string can include white space. However, behavior differs on some other systems. Some systems use the first white space to terminate optional-arg. On some systems, an interpreter script can have multiple arguments, and white spaces in optional-arg are used to delimit the arguments. So /usr/bin/env apparently does some argument splitting itself when called with -S. : http://man7.org/linux/man-pages/man2/execve.2.html#NOTES - Roland -- Roland Hieber, Pengutronix e.K. | r.hie...@pengutronix.de | Steuerwalder Str. 21 | https://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list email@example.com http://lists.infradead.org/mailman/listinfo/barebox