Message ID | 20170605073740.855-1-francois.perrad@gadz.org |
---|---|
State | Accepted |
Headers | show |
>>>>> "Francois" == Francois Perrad <fperrad@gmail.com> writes: > Signed-off-by: Francois Perrad <francois.perrad@gadz.org> Out of interest, what distribution doesn't have bash in /bin? #!/bin/bash is a quite common shebang, and we use it in several places outside support/scripts.
François, All, On 2017-06-05 09:37 +0200, Francois Perrad spake thusly: > Signed-off-by: Francois Perrad <francois.perrad@gadz.org> Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Regards, Yann E. MORIN. > --- > support/scripts/br2-external | 2 +- > support/scripts/check-bin-arch | 2 +- > support/scripts/fix-configure-powerpc64.sh | 2 +- > support/scripts/genimage.sh | 2 +- > support/scripts/hardlink-or-copy | 2 +- > support/scripts/test-pkg | 2 +- > 6 files changed, 6 insertions(+), 6 deletions(-) > > diff --git a/support/scripts/br2-external b/support/scripts/br2-external > index 7e816081..00cb57d1 100755 > --- a/support/scripts/br2-external > +++ b/support/scripts/br2-external > @@ -1,4 +1,4 @@ > -#!/bin/bash > +#!/usr/bin/env bash > set -e > > # This script must be able to run with bash-3.1, so it can't use > diff --git a/support/scripts/check-bin-arch b/support/scripts/check-bin-arch > index ff974a71..b822cdd6 100755 > --- a/support/scripts/check-bin-arch > +++ b/support/scripts/check-bin-arch > @@ -1,4 +1,4 @@ > -#!/bin/bash > +#!/usr/bin/env bash > > while getopts p:l:r:a: OPT ; do > case "${OPT}" in > diff --git a/support/scripts/fix-configure-powerpc64.sh b/support/scripts/fix-configure-powerpc64.sh > index ad710422..ff2b283c 100755 > --- a/support/scripts/fix-configure-powerpc64.sh > +++ b/support/scripts/fix-configure-powerpc64.sh > @@ -1,4 +1,4 @@ > -#!/bin/bash > +#!/usr/bin/env bash > > # This is a script to find, and correct, a problem with old versions of > # configure that affect powerpc64 and powerpc64le. > diff --git a/support/scripts/genimage.sh b/support/scripts/genimage.sh > index 6c8d9e5a..625afc10 100755 > --- a/support/scripts/genimage.sh > +++ b/support/scripts/genimage.sh > @@ -1,4 +1,4 @@ > -#!/bin/bash > +#!/usr/bin/env bash > > die() { > echo "Error: $@" >&2 > diff --git a/support/scripts/hardlink-or-copy b/support/scripts/hardlink-or-copy > index b046bdf0..a052318f 100755 > --- a/support/scripts/hardlink-or-copy > +++ b/support/scripts/hardlink-or-copy > @@ -1,4 +1,4 @@ > -#!/bin/bash > +#!/usr/bin/env bash > > # Try to hardlink a file into a directory, fallback to copy on failure. > # > diff --git a/support/scripts/test-pkg b/support/scripts/test-pkg > index f08c6087..7633a21e 100755 > --- a/support/scripts/test-pkg > +++ b/support/scripts/test-pkg > @@ -1,4 +1,4 @@ > -#!/bin/bash > +#!/usr/bin/env bash > set -e > > TOOLCHAINS_URL='http://autobuild.buildroot.org/toolchains/configs/toolchain-configs.csv' > -- > 2.12.2 > > _______________________________________________ > buildroot mailing list > buildroot@busybox.net > http://lists.busybox.net/mailman/listinfo/buildroot
Hello, On Mon, 5 Jun 2017 09:37:40 +0200, Francois Perrad wrote: > Signed-off-by: Francois Perrad <francois.perrad@gadz.org> > --- > support/scripts/br2-external | 2 +- > support/scripts/check-bin-arch | 2 +- > support/scripts/fix-configure-powerpc64.sh | 2 +- > support/scripts/genimage.sh | 2 +- > support/scripts/hardlink-or-copy | 2 +- > support/scripts/test-pkg | 2 +- > 6 files changed, 6 insertions(+), 6 deletions(-) Applied to master, thanks. Thomas
2017-06-08 16:47 GMT+02:00 Peter Korsgaard <peter@korsgaard.com>: > >>>>> "Francois" == Francois Perrad <fperrad@gmail.com> writes: > > > Signed-off-by: Francois Perrad <francois.perrad@gadz.org> > > Out of interest, what distribution doesn't have bash in /bin? > #!/bin/bash is a quite common shebang, and we use it in several places > outside support/scripts. > > I found this issue with NixOS (http://nixos.org/) where: $ ls /bin sh $ ls /usr/bin env $ which bash /run/current-system/sw/bin/bash $ which which /run/current-system/sw/bin/which so, #!/bin/sh is the only shebang which doesn't require to start with #!/usr/bin/env François > -- > Bye, Peter Korsgaard > _______________________________________________ > buildroot mailing list > buildroot@busybox.net > http://lists.busybox.net/mailman/listinfo/buildroot >
>>>>> "François" == François Perrad <francois.perrad@gadz.org> writes: > 2017-06-08 16:47 GMT+02:00 Peter Korsgaard <peter@korsgaard.com>: >> >>>>> "Francois" == Francois Perrad <fperrad@gmail.com> writes: >> >> > Signed-off-by: Francois Perrad <francois.perrad@gadz.org> >> >> Out of interest, what distribution doesn't have bash in /bin? >> #!/bin/bash is a quite common shebang, and we use it in several places >> outside support/scripts. >> >> > I found this issue with NixOS (http://nixos.org/) where: > $ ls /bin > sh > $ ls /usr/bin > env > $ which bash > /run/current-system/sw/bin/bash > $ which which > /run/current-system/sw/bin/which > so, #!/bin/sh is the only shebang which doesn't require to start with > #!/usr/bin/env And /bin/sh is a symlink to /run/current-system/sw/bin/bash? Otherwise I don't understand how the logic in Makefile and support/dependencies/dependencies.sh could work? What about packages? Are there no package build systems that hardcodes /bin/bash?
2017-06-08 23:58 GMT+02:00 Peter Korsgaard <peter@korsgaard.com>: > >>>>> "François" == François Perrad <francois.perrad@gadz.org> writes: > > > 2017-06-08 16:47 GMT+02:00 Peter Korsgaard <peter@korsgaard.com>: > >> >>>>> "Francois" == Francois Perrad <fperrad@gmail.com> writes: > >> > >> > Signed-off-by: Francois Perrad <francois.perrad@gadz.org> > >> > >> Out of interest, what distribution doesn't have bash in /bin? > >> #!/bin/bash is a quite common shebang, and we use it in several places > >> outside support/scripts. > >> > >> > > I found this issue with NixOS (http://nixos.org/) where: > > $ ls /bin > > sh > > $ ls /usr/bin > > env > > $ which bash > > /run/current-system/sw/bin/bash > > $ which which > > /run/current-system/sw/bin/which > > > so, #!/bin/sh is the only shebang which doesn't require to start with > > #!/usr/bin/env > > And /bin/sh is a symlink to /run/current-system/sw/bin/bash? Otherwise I > don't understand how the logic in Makefile and > support/dependencies/dependencies.sh could work? > /bin/sh is a symlink to /nix/store/bxr5lwdhhgfh1p28mh3w7kyc0spk7niz-bash-4.4-p5/bin/sh /run/current-system/sw/bin/bash is a symlink to /nix/store/bxr5lwdhhgfh1p28mh3w7kyc0spk7niz-bash-4.4-p5/bin/bash > > What about packages? Are there no package build systems that hardcodes > /bin/bash? > No. Packages needed by Buildroot could be declared like this : https://github.com/fperrad/misc/blob/master/nix/buildroot.nix François > > -- > Bye, Peter Korsgaard >
>>>>> "François" == François Perrad <francois.perrad@gadz.org> writes: Hi, >> And /bin/sh is a symlink to /run/current-system/sw/bin/bash? Otherwise I >> don't understand how the logic in Makefile and >> support/dependencies/dependencies.sh could work? >> > /bin/sh is a symlink to > /nix/store/bxr5lwdhhgfh1p28mh3w7kyc0spk7niz-bash-4.4-p5/bin/sh > /run/current-system/sw/bin/bash is a symlink to > /nix/store/bxr5lwdhhgfh1p28mh3w7kyc0spk7niz-bash-4.4-p5/bin/bash Ok, and than ../bin/sh is presumably a symlink to ../bin/bash? >> What about packages? Are there no package build systems that hardcodes >> /bin/bash? >> > No. > Packages needed by Buildroot could be declared like this : > https://github.com/fperrad/misc/blob/master/nix/buildroot.nix What I mean is that seeing scripts with the #!/bin/bash shebang is quite common, so I wouldn't be surprised if some of the upstream build systems used by some of the packages we have in buildroot use that. For one, some of our board specific scripts use it: board/stmicroelectronics/stm32f429-disco/flash.sh:#!/bin/bash board/stmicroelectronics/stm32f469-disco/flash.sh:#!/bin/bash board/technologic/ts4800/post-image.sh:#!/bin/bash board/technologic/ts4900/post-image.sh:#!/bin/bash
diff --git a/support/scripts/br2-external b/support/scripts/br2-external index 7e816081..00cb57d1 100755 --- a/support/scripts/br2-external +++ b/support/scripts/br2-external @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e # This script must be able to run with bash-3.1, so it can't use diff --git a/support/scripts/check-bin-arch b/support/scripts/check-bin-arch index ff974a71..b822cdd6 100755 --- a/support/scripts/check-bin-arch +++ b/support/scripts/check-bin-arch @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash while getopts p:l:r:a: OPT ; do case "${OPT}" in diff --git a/support/scripts/fix-configure-powerpc64.sh b/support/scripts/fix-configure-powerpc64.sh index ad710422..ff2b283c 100755 --- a/support/scripts/fix-configure-powerpc64.sh +++ b/support/scripts/fix-configure-powerpc64.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # This is a script to find, and correct, a problem with old versions of # configure that affect powerpc64 and powerpc64le. diff --git a/support/scripts/genimage.sh b/support/scripts/genimage.sh index 6c8d9e5a..625afc10 100755 --- a/support/scripts/genimage.sh +++ b/support/scripts/genimage.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash die() { echo "Error: $@" >&2 diff --git a/support/scripts/hardlink-or-copy b/support/scripts/hardlink-or-copy index b046bdf0..a052318f 100755 --- a/support/scripts/hardlink-or-copy +++ b/support/scripts/hardlink-or-copy @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Try to hardlink a file into a directory, fallback to copy on failure. # diff --git a/support/scripts/test-pkg b/support/scripts/test-pkg index f08c6087..7633a21e 100755 --- a/support/scripts/test-pkg +++ b/support/scripts/test-pkg @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e TOOLCHAINS_URL='http://autobuild.buildroot.org/toolchains/configs/toolchain-configs.csv'
Signed-off-by: Francois Perrad <francois.perrad@gadz.org> --- support/scripts/br2-external | 2 +- support/scripts/check-bin-arch | 2 +- support/scripts/fix-configure-powerpc64.sh | 2 +- support/scripts/genimage.sh | 2 +- support/scripts/hardlink-or-copy | 2 +- support/scripts/test-pkg | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-)