From f1e6f93372ca2dcee75e3ef0ee6cbe9945cf41f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Sun, 12 Dec 2021 20:27:04 +0100 Subject: [PATCH 1/3] Change all fixed-path bash shebangs to /u/b/env bash outside test/ --- .github/workflows/build_test.sh | 2 +- .github/workflows/run_mkosi.sh | 2 +- .github/workflows/unit_tests.sh | 2 +- .semaphore/semaphore-runner.sh | 2 +- coccinelle/run-coccinelle.sh | 3 ++- man/50-xdg-data-dirs.sh | 4 ++-- src/basic/check-filesystems.sh | 2 +- src/rpm/systemd-update-helper.in | 2 +- tools/check-api-docs.sh | 2 +- tools/check-help.sh | 2 +- tools/get-coverity.sh | 2 +- 11 files changed, 13 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build_test.sh b/.github/workflows/build_test.sh index 96f532ab22e..5dc54771bae 100755 --- a/.github/workflows/build_test.sh +++ b/.github/workflows/build_test.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # SPDX-License-Identifier: LGPL-2.1-or-later set -ex diff --git a/.github/workflows/run_mkosi.sh b/.github/workflows/run_mkosi.sh index 5d4798b5b7a..e8803239aa6 100755 --- a/.github/workflows/run_mkosi.sh +++ b/.github/workflows/run_mkosi.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # SPDX-License-Identifier: LGPL-2.1-or-later # shellcheck disable=SC2064 diff --git a/.github/workflows/unit_tests.sh b/.github/workflows/unit_tests.sh index ec7e92a49a7..9c7beb6d19e 100755 --- a/.github/workflows/unit_tests.sh +++ b/.github/workflows/unit_tests.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # SPDX-License-Identifier: LGPL-2.1-or-later # shellcheck disable=SC2206 diff --git a/.semaphore/semaphore-runner.sh b/.semaphore/semaphore-runner.sh index 381504fd3b9..d02b449e0eb 100755 --- a/.semaphore/semaphore-runner.sh +++ b/.semaphore/semaphore-runner.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # SPDX-License-Identifier: LGPL-2.1-or-later set -eux diff --git a/coccinelle/run-coccinelle.sh b/coccinelle/run-coccinelle.sh index becb38bf913..3249722863d 100755 --- a/coccinelle/run-coccinelle.sh +++ b/coccinelle/run-coccinelle.sh @@ -1,5 +1,6 @@ -#!/bin/bash -e +#!/usr/bin/env bash # SPDX-License-Identifier: LGPL-2.1-or-later +set -e # Exclude following paths from the Coccinelle transformations EXCLUDED_PATHS=( diff --git a/man/50-xdg-data-dirs.sh b/man/50-xdg-data-dirs.sh index 02216abf6c6..5f042c5511a 100755 --- a/man/50-xdg-data-dirs.sh +++ b/man/50-xdg-data-dirs.sh @@ -1,11 +1,11 @@ -#!/bin/bash +#!/bin/sh # SPDX-License-Identifier: CC0-1.0 # set the default value XDG_DATA_DIRS="${XDG_DATA_DIRS:-/usr/local/share/:/usr/share}" # add a directory if it exists -if [[ -d /opt/foo/share ]]; then +if [ -d /opt/foo/share ]; then XDG_DATA_DIRS="/opt/foo/share:${XDG_DATA_DIRS}" fi diff --git a/src/basic/check-filesystems.sh b/src/basic/check-filesystems.sh index 026574652e2..696ef610acc 100755 --- a/src/basic/check-filesystems.sh +++ b/src/basic/check-filesystems.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # SPDX-License-Identifier: LGPL-2.1-or-later set -eu set -o pipefail diff --git a/src/rpm/systemd-update-helper.in b/src/rpm/systemd-update-helper.in index 7e007d48065..ab8cdc0ff96 100755 --- a/src/rpm/systemd-update-helper.in +++ b/src/rpm/systemd-update-helper.in @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # SPDX-License-Identifier: LGPL-2.1-or-later set -eu set -o pipefail diff --git a/tools/check-api-docs.sh b/tools/check-api-docs.sh index 0bf053b5ffb..2e973a088be 100755 --- a/tools/check-api-docs.sh +++ b/tools/check-api-docs.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # SPDX-License-Identifier: LGPL-2.1-or-later set -eu set -o pipefail diff --git a/tools/check-help.sh b/tools/check-help.sh index 8e7d236dd90..76ac2926750 100755 --- a/tools/check-help.sh +++ b/tools/check-help.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # SPDX-License-Identifier: LGPL-2.1-or-later set -eu set -o pipefail diff --git a/tools/get-coverity.sh b/tools/get-coverity.sh index 00219bf60fe..b067ed23eba 100755 --- a/tools/get-coverity.sh +++ b/tools/get-coverity.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # SPDX-License-Identifier: LGPL-2.1-or-later # Download and extract coverity tool From a6ac4cbc4efdb674b022709881751b26eebbb8c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Sun, 12 Dec 2021 20:28:39 +0100 Subject: [PATCH 2/3] man/sd-notify: /bin/bash -> /bin/sh, read -> read -r in example --- man/systemd-notify.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/man/systemd-notify.xml b/man/systemd-notify.xml index 3fed92ef0ee..1327d231550 100644 --- a/man/systemd-notify.xml +++ b/man/systemd-notify.xml @@ -166,13 +166,13 @@ after having set up its communication channel. During runtime it sends further status updates to the init system: - #!/bin/bash + #!/bin/sh mkfifo /tmp/waldo systemd-notify --ready --status="Waiting for data…" while : ; do - read a < /tmp/waldo + read -r a < /tmp/waldo systemd-notify --status="Processing $a" # Do something with $a … From 1e8c094cb82aab23f6052b5052d1d85f1d7451ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Sun, 12 Dec 2021 20:30:26 +0100 Subject: [PATCH 3/3] man/sd-run: /bin/bash -> bash in -t example sd-run already does PATH lookup via find_executable_full() --- man/systemd-run.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/man/systemd-run.xml b/man/systemd-run.xml index 99726dabfbb..66ac26c5f87 100644 --- a/man/systemd-run.xml +++ b/man/systemd-run.xml @@ -479,10 +479,10 @@ Dec 08 20:44:48 container systemd[1]: Started /bin/touch /tmp/foo. Allowing access to the tty - The following command invokes /bin/bash as a service - passing its standard input, output and error to the calling TTY. + The following command invokes bash1 + as a service passing its standard input, output and error to the calling TTY. - # systemd-run -t --send-sighup /bin/bash + # systemd-run -t --send-sighup bash