Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp956667lqs; Wed, 6 Mar 2024 01:45:49 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVs3iDvCff8sQHRtkjy8700YEbExcBgDFFerOVFuDAGwexWeI8kZOTvsQqsL9+29YUVpJXIJmgSZP0ECrbPBGmoLT3qTqNtMC3sMucD4Q== X-Google-Smtp-Source: AGHT+IFiky14UNx6IRImxUPXxGjZ4Mv6Hx+bWEP5o0Ucr6LYf7RUHUt1ccX1hesvLPNSre5rn9nq X-Received: by 2002:a05:6512:2345:b0:513:596a:e660 with SMTP id p5-20020a056512234500b00513596ae660mr2077496lfu.42.1709718349147; Wed, 06 Mar 2024 01:45:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709718349; cv=pass; d=google.com; s=arc-20160816; b=mKZeocxQmY+Iu/2ErxuOcXsmgm0euTkcchwbfY7itbX56EW/vBRulKYue7b43+HZ9L L2icCx1Fi5OtbSvQKnEmuh419y+YDVqL7Oh6vxMMQ5D9VrxtZG1hrlgV5+ZgdrPpdKdo Kvy5QQ4Yrlq6W3fKeuJzxF4k4iN5TP+kTkmxug1BDH9lkWJgl+7UIcm0x9ED8gToBKGk c1Mzwj+fitha3/uyLoMlb96LZZZR/BDLIRUWtDC/DsDQHrzhXxCuhAL2y4X3kcxYnTKL qdjM2pT43wQubEgJnOrIbCd/VY5jW/LKxKYwpPRQRraNaNZuWUrKMsLxuB+HWpkAvfuf xKfA== 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=ibtiOLIj6pbKaTxQEfofzGHkOSfHBnm+i0JTW+zswmU=; fh=Z1YWgvxkmJ0/+y4FkLRSZ5mzUdtmyDAS67SU6REkp38=; b=w0D93twQSTqhy6YeFIHNI9GWJZlUKniiMt9laT3YsAuAfWATYywfpedvSsBdxLL6aS 8ewsajox5gATgVyqR0egldlb7x70Ii5H473MIxDKM8NiX+faiPfnBr4X2iMSSVLDivgW MIPV+HxfDd3yEAF94eXDe6f3HMlrgWzKbSnFgw3+PKHrP+QGIueTYT8KO/CEgUXLathL nI8sYeQFIYCHhP6E8+Rsfmqp2OivWQWaz7Eh4BYhKC+s0GMQb+gkRK5O6vShN66HMaEX xfX0AwrO12It64wV1Dbx6iOHt7qQjV+YxXnP9HvS8hRfuYs6VCrll+lQlWBCkRRMvVYy qWxw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OuwaaCWV; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-93654-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-93654-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id m2-20020a50d7c2000000b0056568fe52eesi5755270edj.565.2024.03.06.01.45.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Mar 2024 01:45:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-93654-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OuwaaCWV; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-93654-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-93654-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 am.mirrors.kernel.org (Postfix) with ESMTPS id D7D851F251E1 for ; Wed, 6 Mar 2024 09:45:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0CA706087D; Wed, 6 Mar 2024 09:43:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="OuwaaCWV" 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 2851F605DF; Wed, 6 Mar 2024 09:43:32 +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=1709718213; cv=none; b=A1A09aAtK0hMEVl8UriPZDqHBJKEwq2FSmP7hkXPUnu69IGWcmm2PK1PL87BwV+iGS0mfOoT/mHHUVhwFmedLEzgzYhEeEbHFGG3fNnB8NCSTYrVJXJDqkFagHqZpFPEqdwNXvRFVzKBABp0xR5YQgmbNoqDWE8b3C0g2pxcUmE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709718213; c=relaxed/simple; bh=NwkktJOVOyOm11rJZM5DvBJM453FEZ9/E/K3un3haFI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=kVsrzoq9jf36pBvs4kCZWUTDg3p/CKpXUAP6+LMe8QV6yYS5p1WTJeWwtIUqu3FocVeG4vhEK9bPlsohHHhbT0I0bRcxj7nfND/xP1ABT5gfJ9Py+/2yzFhB1dmF6hvAuYMWm7JTgWouku4Yajd+nwzwFkocgWUokH/Qfrx/a40= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=OuwaaCWV; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 53849C43330; Wed, 6 Mar 2024 09:43:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709718212; bh=NwkktJOVOyOm11rJZM5DvBJM453FEZ9/E/K3un3haFI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=OuwaaCWVGsiHWDNpC9jrI5NJtCtmdzkOb/YdJB45ESBZkqPHH+cYaWRkvZA11L5Lp DrI3Ys4O03yG5oUH0ljDbPc8zb1SRgDm/Qeq9HpBqR8maRGI7KZf84Z6ftLSm/Tywz Y9QrqSWaWHAsLlpBndtgyoo+I41aQmOBgcmUvmxOrY7nfiNBvgHBNy3m+w6ugub5VR oG71+KmMbr+bMaf3FjgYCHcI5sacYT9KkQBC0L+sFptEriSk2XJNoFgkGdQ8SgMknF PBu7knqWDp1BeVL44anG8L1c/r8xW7k9bTL09OpvZO9ZQC0FU1sTaI0YaCWyy5A9c5 wNwvWmD1ARRmw== From: "Matthieu Baerts (NGI0)" Date: Wed, 06 Mar 2024 10:42:58 +0100 Subject: [PATCH net-next v2 09/12] selftests: mptcp: sockopt: 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: <20240306-upstream-net-next-20240304-selftests-mptcp-shared-code-shellcheck-v2-9-bc79e6e5e6a0@kernel.org> References: <20240306-upstream-net-next-20240304-selftests-mptcp-shared-code-shellcheck-v2-0-bc79e6e5e6a0@kernel.org> In-Reply-To: <20240306-upstream-net-next-20240304-selftests-mptcp-shared-code-shellcheck-v2-0-bc79e6e5e6a0@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=2750; i=matttbe@kernel.org; h=from:subject:message-id; bh=NwkktJOVOyOm11rJZM5DvBJM453FEZ9/E/K3un3haFI=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBl6DqmZIHbUJ9Mq482X+B1t+UQFmjtRM/io+YM7 UV1/+HBMHKJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZeg6pgAKCRD2t4JPQmmg czH2D/4lwAZO4YceOGUm3wEti5VQBo+AgSJauIoRPgXKnoNlb07tN6gRV7HwsBNE335dMF0TiB5 c6xtTExKLhUf3zSd0Og7zraNCOazsh/JgfB5asm8cUXtCxwUhes4Qk/c4S9k2eQ+ZshxeJXypfp /IFVpFR9NXuRdU8OUlBBpdC7f8duDed1fNciX1En1q47GcTXpXC0x7chvacnHIphIExgfLxnFtD Nosh8OqfMLwYcIC65WKo8sdfE5mP2nxUzmeZZVezoLC9LYqSU502OgMs3POJMyALseeexbkFQoK o1dIy2ZF+YHRiMweTbAgv6oHSt+YQpoqEmIWgcz5zJDvvja3mgEz0ExbfmY50zS+rO4BM6pJ1PI TbK5RKNr2qMrFaoYIsbWlJR03roVvPNzOJw+n3HZ1IhOhYeTxQnVfgeHGQ3WwSoakL41L4nYxKl UJ59/J5iiEEKyhbOrrSYLyyIo25aluOjWjCj4f9Ko/OcxBP9iysifkm1iYXAkXjXcXlX3q5k9c/ UOKpININsaD1gox/OqNDOaL/9ArlT5DN2+JbeXTskf88ALHrXh4dZlzde75t408jYaqzs7umHXL 9jJr2SV5hEZRfbBaoSoNveunHCnGumZPcOE5yVNUaPj3vBAcQHyClerjTh+YqaiZATtlqXRRbHv v6A6LyJlHJuDDJQ== 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. - SC2006: Use $(...) notation instead of legacy backticks `...`. - SC2145: Argument mixes string and array. Use * or separate argument. 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/mptcp_sockopt.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh b/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh index 7dd0e5467d35..6ed4aa32222f 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_sockopt.sh @@ -1,6 +1,11 @@ #!/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" ret=0 @@ -8,7 +13,6 @@ sin="" sout="" cin="" cout="" -ksft_skip=4 timeout_poll=30 timeout_test=$((timeout_poll * 2 + 1)) iptables="iptables" @@ -41,7 +45,7 @@ init() mptcp_lib_ns_init ns1 ns2 ns_sbox local i - for i in `seq 1 4`; do + for i in $(seq 1 4); do ip link add ns1eth$i netns "$ns1" type veth peer name ns2eth$i netns "$ns2" ip -net "$ns1" addr add 10.0.$i.1/24 dev ns1eth$i ip -net "$ns1" addr add dead:beef:$i::1/64 dev ns1eth$i nodad @@ -68,6 +72,8 @@ init() add_mark_rules $ns2 2 } +# This function is used in the cleanup trap +#shellcheck disable=SC2317 cleanup() { mptcp_lib_ns_exit "${ns1}" "${ns2}" "${ns_sbox}" @@ -257,12 +263,12 @@ do_tcpinq_test() local lret=$? if [ $lret -ne 0 ];then ret=$lret - echo "FAIL: mptcp_inq $@" 1>&2 + echo "FAIL: mptcp_inq $*" 1>&2 mptcp_lib_result_fail "TCP_INQ: $*" return $lret fi - echo "PASS: TCP_INQ cmsg/ioctl $@" + echo "PASS: TCP_INQ cmsg/ioctl $*" mptcp_lib_result_pass "TCP_INQ: $*" return $lret } -- 2.43.0