From patchwork Tue Jun 18 09:06:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 805797 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D5576155389; Tue, 18 Jun 2024 09:07:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718701646; cv=none; b=G22uzxJAgBOpBVEgLt+TdYJ2SNWKwmqbFbNOD/CeLnFcy4exGFTGQYsBr0qrZGsUz28ym1/4gfY7aUP0F3WwJO3Dhf0Kt4kTfxTVhYjbir6GcDJ80NaMuB41hLRjrPoxCx3yEtcYO0Q45TfTMuJpskXJ5s0d8vPC5ywFLIfaPGM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718701646; c=relaxed/simple; bh=iAcRPr7AOKSjGkTdc99w7XDM1enuja+68OlgB77FMYE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=U2Bd75e3ka0b6XLkO2h01quJmzgFxq9itjysuc2mJIRY8tGVPKHDofdIvGnYstd7mUssvaTbio4t0ujQHnV450SD/mG4MXeAGm8G1w+3Lot+O+z5LW9jVUN1925esotyrXZtzCRXnyfla4zU9+pt9J5Uy2OuNUV99k+WggT74d8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz; spf=pass smtp.mailfrom=suse.cz; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=KhsbSjP6; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=vdw+UY/k; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=KhsbSjP6; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=vdw+UY/k; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.cz Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="KhsbSjP6"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="vdw+UY/k"; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="KhsbSjP6"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="vdw+UY/k" Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id A4B832197C; Tue, 18 Jun 2024 09:07:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1718701639; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=5ZVEYvIYH9j/W1UVN1FalkuLoxY8JnQpAdqMTu+qdf4=; b=KhsbSjP6y0GkinjWslI4OBoh+kALBi/4ivyQ4++K/mVn37Mb09NqUqHbFFntz/RvfAfh19 oGttCyZbD9fueWEZoKQpLFG3+oZOnGDtnBG1FNx6lI/vtYRG83iYWhWPy0kdxWfifMcyC+ bghjjgJT1fjRgEX4nUhmwp47v26770E= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1718701639; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=5ZVEYvIYH9j/W1UVN1FalkuLoxY8JnQpAdqMTu+qdf4=; b=vdw+UY/kFBdiKfLHS8rOpqGy2uyVugyAY0pjhxoM1T6wfQIvhB/9RRD0TcSnbOkUvh86Go 1g0ctgc7on755lAg== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=KhsbSjP6; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b="vdw+UY/k" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1718701639; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=5ZVEYvIYH9j/W1UVN1FalkuLoxY8JnQpAdqMTu+qdf4=; b=KhsbSjP6y0GkinjWslI4OBoh+kALBi/4ivyQ4++K/mVn37Mb09NqUqHbFFntz/RvfAfh19 oGttCyZbD9fueWEZoKQpLFG3+oZOnGDtnBG1FNx6lI/vtYRG83iYWhWPy0kdxWfifMcyC+ bghjjgJT1fjRgEX4nUhmwp47v26770E= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1718701639; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=5ZVEYvIYH9j/W1UVN1FalkuLoxY8JnQpAdqMTu+qdf4=; b=vdw+UY/kFBdiKfLHS8rOpqGy2uyVugyAY0pjhxoM1T6wfQIvhB/9RRD0TcSnbOkUvh86Go 1g0ctgc7on755lAg== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 702121369F; Tue, 18 Jun 2024 09:07:19 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id 0tB6GkdOcWbcEQAAD6G6ig (envelope-from ); Tue, 18 Jun 2024 09:07:19 +0000 From: Petr Vorel To: linux-kernel@vger.kernel.org Cc: Petr Vorel , Randy Dunlap , Thorsten Leemhuis , Jonathan Corbet , Jiri Olsa , Shuah Khan , linux-kselftest@vger.kernel.org Subject: [PATCH 1/2] tools: kernel-chktaint: Fix bashism, simplify code Date: Tue, 18 Jun 2024 11:06:40 +0200 Message-ID: <20240618090641.359008-1-pvorel@suse.cz> X-Mailer: git-send-email 2.45.1 Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Rspamd-Queue-Id: A4B832197C X-Spam-Score: -2.44 X-Spam-Level: X-Spam-Flag: NO X-Spamd-Result: default: False [-2.44 / 50.00]; BAYES_HAM(-2.43)[97.41%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCPT_COUNT_SEVEN(0.00)[8]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.cz:email,suse.cz:dkim]; RCVD_TLS_ALL(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:104:10:150:64:97:from,2a07:de40:b281:106:10:150:64:167:received]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; DKIM_TRACE(0.00)[suse.cz:+] X-Rspamd-Action: no action X-Rspamd-Server: rspamd1.dmz-prg2.suse.org '==' is bashism, '=' needs to be used for comparison. With this fix script can work on systems where the default shell is dash, busybox ash or any other strictly POSIX compatible shell. While at it, also improve: * remove "x" in the comparison (not needed for decades) * use $# for checking number of arguments * cleanup whitespace Fixes: 4ab5a5d2a4a22 ("tools: add a kernel-chktaint to tools/debugging") Signed-off-by: Petr Vorel Acked-by: Thorsten Leemhuis Acked-by: Randy Dunlap --- tools/debugging/kernel-chktaint | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/debugging/kernel-chktaint b/tools/debugging/kernel-chktaint index 279be06332be9..adbb1d621ccd4 100755 --- a/tools/debugging/kernel-chktaint +++ b/tools/debugging/kernel-chktaint @@ -18,11 +18,11 @@ retrieved from /proc/sys/kernel/tainted on another system. EOF } -if [ "$1"x != "x" ]; then - if [ "$1"x == "--helpx" ] || [ "$1"x == "-hx" ] ; then +if [ $# -gt 0 ]; then + if [ "$1" = "--help" ] || [ "$1" = "-h" ]; then usage exit 1 - elif [ $1 -ge 0 ] 2>/dev/null ; then + elif [ $1 -ge 0 ] 2>/dev/null; then taint=$1 else echo "Error: Parameter '$1' not a positive integer. Aborting." >&2 From patchwork Tue Jun 18 09:06:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 805475 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0738D13A3E4; Tue, 18 Jun 2024 09:07:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718701646; cv=none; b=DWkhSGLv1/VBiitsEVVIeDEJhsCLTqAKUaZV10Y5SEt71dUgW1kxR/+FtHW3YOo7pJG3XkSycCdtU6Pyeu63i1rnEuT+6zO+vDPlTs8p6rcvYBtgLe+y/avipavF8NdXo0H+oOEKgmi8ueO36E44nlrPnuHT1ozAbw7F9SfiapY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718701646; c=relaxed/simple; bh=DcQDcRnTlysaR2fXOEprGScuMtRc/WhV+Vp5yh0HA2Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EN4yfLEaAYGBLBkFJnUCSQcNped5N6kZh/YUu9JOOZz+MQJLc1bujLAw5JxOrm0hLbG3IPWSg62DV4MVoxEyRG/K2Z2Q8blisNBpAx0amNBPOJWws93iH70GU2+TyBpaO+XA1KuO5PrH9v0qu0CVhiExNyqa9qRg8s6URPDqWmA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz; spf=pass smtp.mailfrom=suse.cz; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=2+RCRAad; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=2VPE0btW; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=2+RCRAad; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=2VPE0btW; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.cz Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="2+RCRAad"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="2VPE0btW"; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="2+RCRAad"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="2VPE0btW" Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id E1C0C2197E; Tue, 18 Jun 2024 09:07:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1718701639; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6XvNCc8fANotT8kLlUCsy7ONYSq1LLRm8oXVuaOdGI8=; b=2+RCRAad26ybIqGcDZKR7bEtMFLzNd0p5/JeWVVnBi52Kh2ghGqNPaoYCFj0ouQobO3NYY Md41m8Se9+uzkNSa5i2WXkvn8SQ02DRDNSr1zc34Mq+yHqGVFmZmBGkFOJJaExf3jhs2W/ HGgt5APUltBG9ffyaeiMS45SgjM/Ot8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1718701639; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6XvNCc8fANotT8kLlUCsy7ONYSq1LLRm8oXVuaOdGI8=; b=2VPE0btWLUXNw75zeaLNl2Y9VKGedLyTjtlAskJwy4G0P7lV+8tvzsbyrs6zVAxx6Ev/tA kFt5noXydKkqA6Dg== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1718701639; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6XvNCc8fANotT8kLlUCsy7ONYSq1LLRm8oXVuaOdGI8=; b=2+RCRAad26ybIqGcDZKR7bEtMFLzNd0p5/JeWVVnBi52Kh2ghGqNPaoYCFj0ouQobO3NYY Md41m8Se9+uzkNSa5i2WXkvn8SQ02DRDNSr1zc34Mq+yHqGVFmZmBGkFOJJaExf3jhs2W/ HGgt5APUltBG9ffyaeiMS45SgjM/Ot8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1718701639; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6XvNCc8fANotT8kLlUCsy7ONYSq1LLRm8oXVuaOdGI8=; b=2VPE0btWLUXNw75zeaLNl2Y9VKGedLyTjtlAskJwy4G0P7lV+8tvzsbyrs6zVAxx6Ev/tA kFt5noXydKkqA6Dg== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id A936413AC1; Tue, 18 Jun 2024 09:07:19 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id mEuZKEdOcWbcEQAAD6G6ig (envelope-from ); Tue, 18 Jun 2024 09:07:19 +0000 From: Petr Vorel To: linux-kernel@vger.kernel.org Cc: Petr Vorel , Randy Dunlap , Thorsten Leemhuis , Jonathan Corbet , Jiri Olsa , Shuah Khan , linux-kselftest@vger.kernel.org Subject: [PATCH 2/2] tools: build: Fix bashisms in run.sh Date: Tue, 18 Jun 2024 11:06:41 +0200 Message-ID: <20240618090641.359008-2-pvorel@suse.cz> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240618090641.359008-1-pvorel@suse.cz> References: <20240618090641.359008-1-pvorel@suse.cz> Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCPT_COUNT_SEVEN(0.00)[8]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.cz:email]; RCVD_TLS_ALL(0.00)[] X-Spam-Flag: NO X-Spam-Score: -2.80 X-Spam-Level: Fix bashisms: * exit -1 converted to 255 (exit|return with negative status code is not supported on some shells) * 'function' is useless This fixes problems on dash, busybox ash or any other strictly POSIX compatible shell. Fixes: c819e2cf2eb6f ("tools build: Add new build support") Signed-off-by: Petr Vorel --- tools/build/tests/run.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tools/build/tests/run.sh b/tools/build/tests/run.sh index 2c54e4d435464..87d6cad57b20c 100755 --- a/tools/build/tests/run.sh +++ b/tools/build/tests/run.sh @@ -1,20 +1,20 @@ #!/bin/sh # SPDX-License-Identifier: GPL-2.0 -function test_ex { +test_ex() { make -C ex V=1 clean > ex.out 2>&1 make -C ex V=1 >> ex.out 2>&1 if [ ! -x ./ex/ex ]; then echo FAILED - exit -1 + exit 255 fi make -C ex V=1 clean > /dev/null 2>&1 rm -f ex.out } -function test_ex_suffix { +test_ex_suffix() { make -C ex V=1 clean > ex.out 2>&1 # use -rR to disable make's builtin rules @@ -24,19 +24,19 @@ function test_ex_suffix { if [ -x ./ex/ex ]; then echo FAILED - exit -1 + exit 255 fi if [ ! -f ./ex/ex.o -o ! -f ./ex/ex.i -o ! -f ./ex/ex.s ]; then echo FAILED - exit -1 + exit 255 fi make -C ex V=1 clean > /dev/null 2>&1 rm -f ex.out } -function test_ex_include { +test_ex_include() { make -C ex V=1 clean > ex.out 2>&1 # build with krava.h include @@ -45,7 +45,7 @@ function test_ex_include { if [ ! -x ./ex/ex ]; then echo FAILED - exit -1 + exit 255 fi # build without the include @@ -54,7 +54,7 @@ function test_ex_include { if [ ! -x ./ex/ex ]; then echo FAILED - exit -1 + exit 255 fi make -C ex V=1 clean > /dev/null 2>&1