Skip to contentSkip to conversation

support/scripts: fix shebang with bash

PATCH New Francois Perrad 5 participants 8 messages Jun 5, 2017 – Jun 9, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 support/scripts: fix shebang with bash

---
 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(-)
support/scripts/br2-external +1 -1
index 7e816081..00cb57d1 100755
@@ -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
support/scripts/check-bin-arch +1 -1
index ff974a71..b822cdd6 100755
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 while getopts p:l:r:a: OPT ; do
 	case "${OPT}" in
support/scripts/fix-configure-powerpc64.sh +1 -1
index ad710422..ff2b283c 100755
@@ -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.
support/scripts/genimage.sh +1 -1
index 6c8d9e5a..625afc10 100755
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 die() {
   echo "Error: $@" >&2
support/scripts/hardlink-or-copy +1 -1
index b046bdf0..a052318f 100755
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 # Try to hardlink a file into a directory, fallback to copy on failure.
 #
support/scripts/test-pkg +1 -1
index f08c6087..7633a21e 100755
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 set -e
 
 TOOLCHAINS_URL='http://autobuild.buildroot.org/toolchains/configs/toolchain-configs.csv'
Signature · 1 line
2.12.2
#1 lore raw

PATCH 1/1 support/scripts: fix shebang with bash

Quoted 3 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Francois" == Francois Perrad <[email protected]> writes:

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.

Signature · 1 line
Bye, Peter Korsgaard
#2 lore raw

PATCH 1/1 support/scripts: fix shebang with bash

2017-06-08 16:47 GMT+02:00 Peter Korsgaard <[email protected]>:

Quoted 9 lines
Quoted 3 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Francois" == Francois Perrad <[email protected]> writes:

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

Quoted 7 lines

--
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20170608/e352d69e/attachment.html>

#3 lore raw

PATCH 1/1 support/scripts: fix shebang with bash

Quoted 22 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Fran?ois" == Fran?ois Perrad <[email protected]> writes:

2017-06-08 16:47 GMT+02:00 Peter Korsgaard <[email protected]>:

Quoted 9 lines
Quoted 3 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Francois" == Francois Perrad <[email protected]> writes:

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
Quoted 2 lines

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?

Signature · 1 line
Bye, Peter Korsgaard
#4 lore raw

PATCH 1/1 support/scripts: fix shebang with bash

2017-06-08 23:58 GMT+02:00 Peter Korsgaard <[email protected]>:

Quoted 22 lines
Quoted 21 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Fran?ois" == Fran?ois Perrad <[email protected]> writes:

2017-06-08 16:47 GMT+02:00 Peter Korsgaard <[email protected]>:

Quoted 9 lines
Quoted 3 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Francois" == Francois Perrad <[email protected]> writes:

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
Quoted 7 lines
Quoted 2 lines

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

Quoted 4 lines

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

Quoted 4 lines

--
Bye, Peter Korsgaard

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20170609/65605813/attachment.html>

#5 lore raw

PATCH 1/1 support/scripts: fix shebang with bash

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Fran?ois" == Fran?ois Perrad <[email protected]> writes:

Hi,

Quoted 9 lines
Quoted 4 lines

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?

Quoted 7 lines
Quoted 3 lines

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

Signature · 1 line
Bye, Peter Korsgaard
#6 lore raw

PATCH 1/1 support/scripts: fix shebang with bash

In reply to Francois Perrad

Fran?ois, All,

On 2017-06-05 09:37 +0200, Francois Perrad spake thusly:

Quoted 1 line

Regards,
Yann E. MORIN.

Quoted 76 lines
---
 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(-)
support/scripts/br2-external +1 -1
index 7e816081..00cb57d1 100755
@@ -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
support/scripts/check-bin-arch +1 -1
index ff974a71..b822cdd6 100755
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 while getopts p:l:r:a: OPT ; do
 	case "${OPT}" in
support/scripts/fix-configure-powerpc64.sh +1 -1
index ad710422..ff2b283c 100755
@@ -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.
support/scripts/genimage.sh +1 -1
index 6c8d9e5a..625afc10 100755
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 die() {
   echo "Error: $@" >&2
support/scripts/hardlink-or-copy +1 -1
index b046bdf0..a052318f 100755
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 # Try to hardlink a file into a directory, fallback to copy on failure.
 #
support/scripts/test-pkg +1 -1
index f08c6087..7633a21e 100755
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 set -e
 
 TOOLCHAINS_URL='http://autobuild.buildroot.org/toolchains/configs/toolchain-configs.csv'
Signature · 6 lines
2.12.2

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#7 lore raw

PATCH 1/1 support/scripts: fix shebang with bash

In reply to Francois Perrad

Hello,

Quoted 9 lines · Francois Perrad
---
 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

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com