lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <c0a5bfb6-4976-45e3-a936-b7a914bbe5a5@infradead.org>
Date: Sat, 11 Oct 2025 15:26:21 -0700
From: Randy Dunlap <rdunlap@...radead.org>
To: Kevin Locke <kevin@...inlocke.name>, Jonathan Corbet <corbet@....net>,
 Thorsten Leemhuis <linux@...mhuis.info>
Cc: linux-kernel@...r.kernel.org
Subject: Re: [PATCH] tools: fix == bashism in kernel-chktaint



On 10/11/25 3:07 PM, Randy Dunlap wrote:
> 
> 
> 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@...inlocke.name>
> 
> Reviewed-by: Randy Dunlap <rdunlap@...radead.org>

and
Tested-by: Randy Dunlap <rdunlap@...radead.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ