]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
selftests: mptcp: connect: fix shellcheck warnings
authorMatthieu Baerts (NGI0) <matttbe@kernel.org>
Wed, 6 Mar 2024 09:42:57 +0000 (10:42 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 10 Apr 2024 14:38:09 +0000 (16:38 +0200)
commitcd2362882486d0b551bf05d8effbe878de21483e
tree917c9fd9dbe239a980894c0d3c39314a9beaa58d
parent2424643cbbe87605b15f359d1055c0d033da3a1d
selftests: mptcp: connect: fix shellcheck warnings

[ Upstream commit e3aae1098f109f0bd33c971deff1926f4e4441d0 ]

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.
  - SC2181: Check exit code directly with e.g. 'if mycmd;', not
            indirectly with $?.
  - SC2004: $/${} is unnecessary on arithmetic variables.
  - SC2155: Declare and assign separately to avoid masking return
            values.
  - SC2166: Prefer [ p ] && [ q ] as [ p -a q ] is not well defined.
  - SC2059: Don't use variables in the printf format string. Use printf
            '..%s..' "$foo".

Now this script is shellcheck (0.9.0) compliant. We can easily spot new
issues.

Reviewed-by: Mat Martineau <martineau@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Link: https://lore.kernel.org/r/20240306-upstream-net-next-20240304-selftests-mptcp-shared-code-shellcheck-v2-8-bc79e6e5e6a0@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Stable-dep-of: 7a1b3490f47e ("mptcp: don't account accept() of non-MPC client as fallback to TCP")
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/testing/selftests/net/mptcp/mptcp_connect.sh