[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cfa643395a4ae569838b7992c3fe7a3c3797831d.1760366509.git.kevin@kevinlocke.name>
Date: Mon, 13 Oct 2025 08:41:51 -0600
From: Kevin Locke <kevin@...inlocke.name>
To: Jonathan Corbet <corbet@....net>,
Randy Dunlap <rdunlap@...radead.org>,
Thorsten Leemhuis <linux@...mhuis.info>
Cc: linux-kernel@...r.kernel.org
Subject: [PATCH v2] tools: fix == bashism in kernel-chktaint
When /bin/sh is a shell other than bash, invoking kernel-chktaint with
at least one argument may produce error messages such as the following
(produced by dash 0.5.12 with argument 1024):
./kernel-chktaint: 22: [: 1024x: unexpected operator
./kernel-chktaint: 22: [: 1024x: unexpected operator
This occurs because the == operator is not specified for test in POSIX
and is not supported by all shells, as noted by shellcheck SC3014.
To fix the issue and avoid the error message, replace == with =.
Signed-off-by: Kevin Locke <kevin@...inlocke.name>
---
Thanks for the reviews and feedback Thorsten and Randy! I agree it
probably doesn't matter, but I appreciate the value of consistency and
of being aware of those conventions, and it's an easy fix. Thanks for
letting me know about it! Here's an updated version with an improved
commit message.
Thanks again,
Kevin
Changes since v1:
* Remove superfluous links in Markdown format from commit message.
* Add version of dash used to commit message.
tools/debugging/kernel-chktaint | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/debugging/kernel-chktaint b/tools/debugging/kernel-chktaint
index e7da0909d0970..051608a63d9f1 100755
--- a/tools/debugging/kernel-chktaint
+++ b/tools/debugging/kernel-chktaint
@@ -19,7 +19,7 @@ EOF
}
if [ "$1"x != "x" ]; then
- if [ "$1"x == "--helpx" ] || [ "$1"x == "-hx" ] ; then
+ if [ "$1"x = "--helpx" ] || [ "$1"x = "-hx" ] ; then
usage
exit 1
elif [ $1 -ge 0 ] 2>/dev/null ; then
--
2.51.0
Powered by blists - more mailing lists