From: Masahiro Yamada <masahiroy@kernel.org>
To: linux-kbuild@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
Masahiro Yamada <masahiroy@kernel.org>,
Nathan Chancellor <nathan@kernel.org>,
Nicolas Schier <nicolas@fjasle.eu>
Subject: [PATCH 2/2] kbuild: package: add -e and -u options to shell scripts
Date: Wed, 12 Jun 2024 01:08:06 +0900 [thread overview]
Message-ID: <20240611160938.3511096-2-masahiroy@kernel.org> (raw)
In-Reply-To: <20240611160938.3511096-1-masahiroy@kernel.org>
Set -e to make these scripts fail on the first error.
Set -u because these scripts are invoked by Makefile, and do not work
properly without necessary variables defined.
Remove the explicit "test -n ..." from scripts/package/install-extmod-build.
Both options are described in POSIX. [1]
[1]: https://pubs.opengroup.org/onlinepubs/009604499/utilities/set.html
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---
scripts/package/builddeb | 2 +-
scripts/package/buildtar | 2 +-
scripts/package/gen-diff-patch | 2 ++
scripts/package/install-extmod-build | 5 +----
scripts/package/mkdebian | 2 +-
scripts/package/mkspec | 2 ++
6 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index e797ad360f7a..c1757db6aa8a 100755
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -10,7 +10,7 @@
# specified in KDEB_HOOKDIR) that will be called on package install and
# removal.
-set -e
+set -eu
is_enabled() {
grep -q "^$1=y" include/config/auto.conf
diff --git a/scripts/package/buildtar b/scripts/package/buildtar
index eb67787f8673..cc87a473c01f 100755
--- a/scripts/package/buildtar
+++ b/scripts/package/buildtar
@@ -11,7 +11,7 @@
# Wichert Akkerman <wichert@wiggy.net>.
#
-set -e
+set -eu
#
# Some variables and settings used throughout the script
diff --git a/scripts/package/gen-diff-patch b/scripts/package/gen-diff-patch
index 8a98b7bb78a0..f272f7770ea3 100755
--- a/scripts/package/gen-diff-patch
+++ b/scripts/package/gen-diff-patch
@@ -1,6 +1,8 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-only
+set -eu
+
diff_patch=$1
mkdir -p "$(dirname "${diff_patch}")"
diff --git a/scripts/package/install-extmod-build b/scripts/package/install-extmod-build
index 76e0765dfcd6..8cc9e13403ae 100755
--- a/scripts/package/install-extmod-build
+++ b/scripts/package/install-extmod-build
@@ -1,13 +1,10 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-only
-set -e
+set -eu
destdir=${1}
-test -n "${srctree}"
-test -n "${SRCARCH}"
-
is_enabled() {
grep -q "^$1=y" include/config/auto.conf
}
diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian
index 070149c985fe..ecfeb34b99aa 100755
--- a/scripts/package/mkdebian
+++ b/scripts/package/mkdebian
@@ -4,7 +4,7 @@
#
# Simple script to generate a debian/ directory for a Linux kernel.
-set -e
+set -eu
is_enabled() {
grep -q "^$1=y" include/config/auto.conf
diff --git a/scripts/package/mkspec b/scripts/package/mkspec
index ce201bfa8377..cc046ac74bf9 100755
--- a/scripts/package/mkspec
+++ b/scripts/package/mkspec
@@ -9,6 +9,8 @@
# Patched for non-x86 by Opencon (L) 2002 <opencon@rio.skydome.net>
#
+set -eu
+
output=$1
mkdir -p "$(dirname "${output}")"
--
2.43.0
next prev parent reply other threads:[~2024-06-11 16:09 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-11 16:08 [PATCH 1/2] kconfig: add -e and -u options to *conf-cfg.sh scripts Masahiro Yamada
2024-06-11 16:08 ` Masahiro Yamada [this message]
2024-06-12 19:33 ` [PATCH 2/2] kbuild: package: add -e and -u options to shell scripts Nicolas Schier
2024-06-16 15:21 ` Masahiro Yamada
2024-06-16 15:55 ` Nicolas Schier
2024-06-16 16:52 ` Masahiro Yamada
2024-06-16 18:40 ` Nicolas Schier
2024-06-12 19:28 ` [PATCH 1/2] kconfig: add -e and -u options to *conf-cfg.sh scripts Nicolas Schier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240611160938.3511096-2-masahiroy@kernel.org \
--to=masahiroy@kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nathan@kernel.org \
--cc=nicolas@fjasle.eu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox