[Picolibc] [PATCH v2] Change #!/bin/bash shebangs to #!/bin/sh

leon at is.currently.online leon at is.currently.online
Thu Sep 30 01:30:16 PDT 2021


From: Leon Schuermann <leon at is.currently.online>

This change is required to support distributions which do not feature
a bash shell installed under `/bin/bash`, for example NixOS. Hence, in
their current form, scripts specifing this interpreter path cannot be
executed on NixOS and will thus make the compilation process fail. A
common and sensible solution to this issue is to change the
interpreter path to `/bin/sh`. While POSIX.1-2017 explicitly states
that "Applications should note that the standard PATH to the shell
cannot be assumed to be either /bin/sh or /usr/bin/sh" [1], a /bin/sh
shell interpreter has significantly wider adoption than /bin/bash.

The shell scripts affected by this change seem to not utilize any
bash-specific features. Nonetheless these changes mandate a careful
look and tests by someone more familiar with the build and test
processes of newlib and/or picolibc.

[1]: https://pubs.opengroup.org/onlinepubs/9699919799/

Signed-off-by: Leon Schuermann <leon at is.currently.online>
---
 make-target             | 2 +-
 newlib/make-library     | 2 +-
 newlib/make-target      | 2 +-
 scripts/duplicate-names | 2 +-
 scripts/run-aarch64     | 2 +-
 scripts/run-arm         | 2 +-
 scripts/run-i686        | 2 +-
 scripts/run-thumbv7e    | 2 +-
 scripts/run-thumbv7m    | 2 +-
 scripts/run-x86_64      | 2 +-
 10 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/make-target b/make-target
index b6c42bddb..4a1c7b71c 100755
--- a/make-target
+++ b/make-target
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 
 ARCH=$1
 GCC="$ARCH"-gcc
diff --git a/newlib/make-library b/newlib/make-library
index 2df9df60a..33bb9959b 100755
--- a/newlib/make-library
+++ b/newlib/make-library
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 
 dir=`basename $PWD`
 
diff --git a/newlib/make-target b/newlib/make-target
index b6c42bddb..4a1c7b71c 100755
--- a/newlib/make-target
+++ b/newlib/make-target
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 
 ARCH=$1
 GCC="$ARCH"-gcc
diff --git a/scripts/duplicate-names b/scripts/duplicate-names
index 9cb9a3a35..f1dc653e9 100755
--- a/scripts/duplicate-names
+++ b/scripts/duplicate-names
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 NM="$1"
 FILE="$2"
 OUTPUT="$3"
diff --git a/scripts/run-aarch64 b/scripts/run-aarch64
index d1ef968d7..3307073a1 100755
--- a/scripts/run-aarch64
+++ b/scripts/run-aarch64
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 #
 # SPDX-License-Identifier: BSD-3-Clause
 #
diff --git a/scripts/run-arm b/scripts/run-arm
index c84c624cd..e6c3c51d1 100755
--- a/scripts/run-arm
+++ b/scripts/run-arm
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 #
 # SPDX-License-Identifier: BSD-3-Clause
 #
diff --git a/scripts/run-i686 b/scripts/run-i686
index 4667acc04..0eeb406ec 100755
--- a/scripts/run-i686
+++ b/scripts/run-i686
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 #
 # SPDX-License-Identifier: BSD-3-Clause
 #
diff --git a/scripts/run-thumbv7e b/scripts/run-thumbv7e
index d1672b338..51623828e 100755
--- a/scripts/run-thumbv7e
+++ b/scripts/run-thumbv7e
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 #
 # SPDX-License-Identifier: BSD-3-Clause
 #
diff --git a/scripts/run-thumbv7m b/scripts/run-thumbv7m
index d8d232d67..3a1b60c9c 100755
--- a/scripts/run-thumbv7m
+++ b/scripts/run-thumbv7m
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 #
 # SPDX-License-Identifier: BSD-3-Clause
 #
diff --git a/scripts/run-x86_64 b/scripts/run-x86_64
index 972e60213..30856359a 100755
--- a/scripts/run-x86_64
+++ b/scripts/run-x86_64
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 #
 # SPDX-License-Identifier: BSD-3-Clause
 #

base-commit: 4ee72cef423e1961acd7981354a96dd8b5f55467
-- 
2.33.0



More information about the Picolibc mailing list