Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp312928lqs; Tue, 5 Mar 2024 02:52:49 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWQsYPK+Os2esUciT6xLHuYnpdI0N5cuH4CDyQrAxOrykz8WsTeyE+N3lhMQYRLR+zt330kym2XCYB6jYOuyGR3VDnQyOKBEsnKXVBY2A== X-Google-Smtp-Source: AGHT+IHEoJYijt/f6hopOZFbH9jib1Yj7atGc57SYUD+S22Z2bu/q0ZwJ/wu1K1xallnyvZ+/1Lz X-Received: by 2002:a54:4803:0:b0:3c1:ef0b:f3de with SMTP id j3-20020a544803000000b003c1ef0bf3demr1310749oij.52.1709635969149; Tue, 05 Mar 2024 02:52:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709635969; cv=pass; d=google.com; s=arc-20160816; b=s79JNPaZRwQT6CfDRODku/IsRJy+97sYTGISuWfT/5WH4xo23aL7QlUpoG463fE5sA Lns6dHhk+cCJoFc2vilPSWp30YPs1m8P4ZevVO3VniPb8+h/l13En7YXGS+7J87s5Z0v qSiTQ/19+VNvCXdxzX5XzxVW+jT7UqtIRWhp2BXlxDsrXztnw5WYDhUQZQB4PZGmbuVG dofm3o9kl6YgtuZljDGYX4nKokBn7kwKymw/JTdB1mnOO7aqpg5/zIKEVd9NFjJDm3zr 2xZ9wSBElgFKYihqldn9bB68ge4+qCMq1E4qT3IUcAggVPkjErT3jeEuWMVbDAvqGKT8 r2tA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=cxYrJmF4ZZ58otOjXLZzIMhOz8MylC3bdwrzyNPW2Us=; fh=Z1YWgvxkmJ0/+y4FkLRSZ5mzUdtmyDAS67SU6REkp38=; b=Ov6XrLZsrzLvt/I1yoaHwV8lI/LHlzQSKiL/NjkePMTZesqXdGIo0H2AFfxp9coq3Z JUvQ1Ypad8yP30Y86WAM6aHRgYAxArKZPCW3p2730vq2PUfbPXQNQgz+Jlz7DW816DAL pu/sWFRLXmHCL17hZ4YXWrbw3xhEYz4EvSXdiHwCKHaOXym/lpFeSjqwiDE0zGQ51Id8 yZVX3CotCXjdp9go892L+q9C9j+okd151W9jzSH7Kf+Tobsfarp/k7twlQDRGQ2dooga eR3WBQv3ORbUKQfiD8lyD2vWKTQ/J4/KwDvMoEnNAyiE03Vsmx0IQ0zVbKUcK9lSNf7r HD9Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TkX4hHEA; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-92169-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-92169-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id k20-20020a628414000000b006e5586f1c83si9756117pfd.280.2024.03.05.02.52.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 02:52:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-92169-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TkX4hHEA; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-92169-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-92169-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id C825128482C for ; Tue, 5 Mar 2024 10:52:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B4F4C5FB8A; Tue, 5 Mar 2024 10:43:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="TkX4hHEA" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CD7095F856; Tue, 5 Mar 2024 10:43:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709635404; cv=none; b=bxBswG+oA1c/EUp02F8gtWYGg0C2FgHrLG+9T4KzBVqhYxVBoo1zwdb7OEp0ZDWzQSBMGEFJ3GlGtH1SXsQiPeGjsMnpxw4+DGEm4pQzm2ZydSVJ5GrTbRkihJ+jmpAgYg1bv1lc6XLuwPjOEmgUwlsriiB9xxO6SEAfyUIDl/g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709635404; c=relaxed/simple; bh=jTLgdGpKQfPiNeklV9atb8fDhX9KNQWViIOBx/XoGv0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=mKtMTpxVDafWpEttanJBjBGbogk7ewK7WTMWinXv+ydYtXXYTFa9vkDULl7ZbGqM46J1O43TlLaR61A9HXffSW+JuyMDf/tH9kXF0o6NK7UaN6Ip8MqTE/mCEfsxk816NOts+nuGJl1+Tm2NRXZku4YsYrDQeKf4FNuHLksBiXM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=TkX4hHEA; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83A6DC433B1; Tue, 5 Mar 2024 10:43:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709635404; bh=jTLgdGpKQfPiNeklV9atb8fDhX9KNQWViIOBx/XoGv0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=TkX4hHEAMClVUn5nkuG5bKcrNOWmUZP7Qk64sESHK0pPhjNrzXUoh0WG6V6GZizZo fUYHbEI0jtC8x3B66nQ9TLDm+GbtX4dl5ajCSNQHOKKgH6FBJgGf+dOeREJCefcMr7 G4v6WTrzon3H4QQgMIO35XBv5dlWSNArRAHFJ/PyjdPHQa1J1PgD4KPc6syje8Ur4N MIXKJiTRyewLqzRnsOopGfmycONRuypVOSWLLamCC3HtRYELFJSuFD1PjtJumO2LdZ x/kHR3rVZHxV/6bEeD3QrIFo/KIpj9qv9gKlzyDIBOE2JJYVXWrHps+JzTYhJa98J+ R+2NLfqV02ZcA== From: "Matthieu Baerts (NGI0)" Date: Tue, 05 Mar 2024 11:42:41 +0100 Subject: [PATCH net-next 11/13] selftests: mptcp: pm netlink: fix shellcheck warnings Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240305-upstream-net-next-20240304-selftests-mptcp-shared-code-shellcheck-v1-11-66618ea5504e@kernel.org> References: <20240305-upstream-net-next-20240304-selftests-mptcp-shared-code-shellcheck-v1-0-66618ea5504e@kernel.org> In-Reply-To: <20240305-upstream-net-next-20240304-selftests-mptcp-shared-code-shellcheck-v1-0-66618ea5504e@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan Cc: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, "Matthieu Baerts (NGI0)" X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2721; i=matttbe@kernel.org; h=from:subject:message-id; bh=jTLgdGpKQfPiNeklV9atb8fDhX9KNQWViIOBx/XoGv0=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBl5vcd0nNYXiB6l2gK9AMj8z81KZJvYD2h/Kcwp o8JFWhK546JAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZeb3HQAKCRD2t4JPQmmg c1/xEACpHrO9MASyiQCrywtvnuF8Lo5h4lBmRPGQcbLqVmrLGLVKzjADDr1QbIuavPw77HxnGPT KB1+v8cQ2BM0YlQ+/tAemy9vy+0yVJ+25UPbyesNf5bjnllSzYvzbliC2WkDZnB0DO6Xk+SRCtd 0P5Rea6iJMK2y/fKMS/SbD6jNEDBKWh0KN0kERmjJMpGrBa9u5pMM/DaQKZ+M1BJ51uCNHPHBx0 tFbc+JxqqhgsZsRrM3/OVr+isEpl/D/dzOk5PT2vtMEgKdQ1LDb2W5uxliW4c6/zP2UWqLqiOiz 4IxcmcCb/mDeXSNn9VP4Q5PkTnuAcVj3bwzba4O1AE5M4Vdsah9Zs08UWET41MPUF8KU/6pqa2x N+3jrL6gDWZZyiPqbkfuUzwiQo07m+s4tnQJN6lDIfNQz76ugJ12nFii8PlqS9cLB1HXqWlkN1S aeoCi5RzewaFbBFjZHd6ob5gopZ6e6uzbAIuhbUZtNHPGFURn2bRvh1+keDaDjTQ361WICPbfoY ZaAznn+nY5B3oT0XvN7cblT+gZSfvCyQ1SYIj6Nxd8I6WQZda9Tmdo5dA6J2IprQJ7Kc38vtSCM 0xY9u/+b+M7aS2JKBTNuhIQOBL5VUm6TJ9QGa3djffgkEjkq4kLRLOGuiU8JxjTTnkhprKtf+hO 8tuXecsCBFGyzmQ== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 shellcheck recently helped to prevent issues. It is then good to fix the other harmless issues in order to spot "real" ones later. Here, two categories of warnings are now ignored: - SC2317: Command appears to be unreachable. The cleanup() function is invoked indirectly via the EXIT trap. - SC2086: Double quote to prevent globbing and word splitting. This is recommended, but the current usage is correct and there is no need to do all these modifications to be compliant with this rule. For the modifications: - SC2034: ksft_skip appears unused. - SC2154: optstring is referenced but not assigned. - SC2006: Use $(...) notation instead of legacy backticks `...`. Now this script is shellcheck (0.9.0) compliant. We can easily spot new issues. Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts (NGI0) --- tools/testing/selftests/net/mptcp/pm_netlink.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/pm_netlink.sh b/tools/testing/selftests/net/mptcp/pm_netlink.sh index c7c46152f6fd..427fc5c70b3c 100755 --- a/tools/testing/selftests/net/mptcp/pm_netlink.sh +++ b/tools/testing/selftests/net/mptcp/pm_netlink.sh @@ -1,16 +1,20 @@ #!/bin/bash # SPDX-License-Identifier: GPL-2.0 +# Double quotes to prevent globbing and word splitting is recommended in new +# code but we accept it, especially because there were too many before having +# address all other issues detected by shellcheck. +#shellcheck disable=SC2086 + . "$(dirname "${0}")/mptcp_lib.sh" -ksft_skip=4 ret=0 usage() { echo "Usage: $0 [ -h ]" } - +optstring=h while getopts "$optstring" option;do case "$option" in "h") @@ -27,6 +31,8 @@ done ns1="" err=$(mktemp) +# This function is used in the cleanup trap +#shellcheck disable=SC2317 cleanup() { rm -f $err @@ -91,14 +97,14 @@ check "ip netns exec $ns1 ./pm_nl_ctl get 4" "" "duplicate addr" ip netns exec $ns1 ./pm_nl_ctl add 10.0.1.4 flags signal check "ip netns exec $ns1 ./pm_nl_ctl get 4" "id 4 flags signal 10.0.1.4" "id addr increment" -for i in `seq 5 9`; do +for i in $(seq 5 9); do ip netns exec $ns1 ./pm_nl_ctl add 10.0.1.$i flags signal >/dev/null 2>&1 done check "ip netns exec $ns1 ./pm_nl_ctl get 9" "id 9 flags signal 10.0.1.9" "hard addr limit" check "ip netns exec $ns1 ./pm_nl_ctl get 10" "" "above hard addr limit" ip netns exec $ns1 ./pm_nl_ctl del 9 -for i in `seq 10 255`; do +for i in $(seq 10 255); do ip netns exec $ns1 ./pm_nl_ctl add 10.0.0.9 id $i ip netns exec $ns1 ./pm_nl_ctl del $i done -- 2.43.0