mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Randy Dunlap <rdunlap@infradead.org>
To: Kevin Locke <kevin@kevinlocke.name>,
	Jonathan Corbet <corbet@lwn.net>,
	Thorsten Leemhuis <linux@leemhuis.info>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] tools: fix == bashism in kernel-chktaint
Date: Sat, 11 Oct 2025 15:07:11 -0700	[thread overview]
Message-ID: <f5949227-7bd3-4fd0-b873-e79d0768a1be@infradead.org> (raw)
In-Reply-To: <1531d0cd452f1870e1703c263b11d718c46b54bb.1760216665.git.kevin@kevinlocke.name>



On 10/11/25 2:04 PM, Kevin Locke wrote:
> 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] 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 =.
> 
> [dash]: https://git.kernel.org/pub/scm/utils/dash/dash.git
> [test in POSIX]: https://pubs.opengroup.org/onlinepubs/9799919799/utilities/test.html
> [SC3014]: https://www.shellcheck.net/wiki/SC3014
> 
> Signed-off-by: Kevin Locke <kevin@kevinlocke.name>

Reviewed-by: Randy Dunlap <rdunlap@infradead.org>

Thanks.

> ---
>  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

-- 
~Randy

  reply	other threads:[~2025-10-11 22:07 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-11 21:04 Kevin Locke
2025-10-11 22:07 ` Randy Dunlap [this message]
2025-10-11 22:26   ` Randy Dunlap
2025-10-13  6:52 ` Thorsten Leemhuis
2025-10-13 14:41   ` [PATCH v2] " Kevin Locke
2025-10-13 16:46     ` Randy Dunlap
2025-10-16 20:47 ` [PATCH] " David Laight
2025-10-16 23:47   ` [PATCH] tools: remove unnecessary x suffix in test strings Kevin Locke
2025-10-17  4:00     ` Randy Dunlap
2025-10-17 14:12     ` David Laight
2025-10-17 22:28       ` Kevin Locke
2025-10-19 10:17         ` David Laight
2025-10-20 20:18           ` Kevin Locke
2025-10-21  8:59             ` David Laight

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=f5949227-7bd3-4fd0-b873-e79d0768a1be@infradead.org \
    --to=rdunlap@infradead.org \
    --cc=corbet@lwn.net \
    --cc=kevin@kevinlocke.name \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@leemhuis.info \
    /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

all inboxes | Powered by JetHome®