[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ECADFF3FD767C149AD96A924E7EA6EAF977A2939@USCULXMSG01.am.sony.com>
Date: Wed, 14 Aug 2019 23:34:54 +0000
From: <Tim.Bird@...y.com>
To: <anders.roxell@...aro.org>, <davem@...emloft.net>,
<shuah@...nel.org>
CC: <netdev@...r.kernel.org>, <linux-kselftest@...r.kernel.org>,
<linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] selftests: net: tcp_fastopen_backup_key.sh: fix
shellcheck issue
> -----Original Message-----
> From: Anders Roxell
>
> When running tcp_fastopen_backup_key.sh the following issue was seen in
> a busybox environment.
> ./tcp_fastopen_backup_key.sh: line 33: [: -ne: unary operator expected
>
> Shellcheck showed the following issue.
> $ shellcheck tools/testing/selftests/net/tcp_fastopen_backup_key.sh
>
> In tools/testing/selftests/net/tcp_fastopen_backup_key.sh line 33:
> if [ $val -ne 0 ]; then
> ^-- SC2086: Double quote to prevent globbing and word splitting.
>
> Rework to add double quotes around the variable 'val' that shellcheck
> recommends.
>
> Signed-off-by: Anders Roxell <anders.roxell@...aro.org>
> ---
> tools/testing/selftests/net/tcp_fastopen_backup_key.sh | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/net/tcp_fastopen_backup_key.sh
> b/tools/testing/selftests/net/tcp_fastopen_backup_key.sh
> index 41476399e184..ba5ec3eb314e 100755
> --- a/tools/testing/selftests/net/tcp_fastopen_backup_key.sh
> +++ b/tools/testing/selftests/net/tcp_fastopen_backup_key.sh
> @@ -30,7 +30,7 @@ do_test() {
> ip netns exec "${NETNS}" ./tcp_fastopen_backup_key "$1"
> val=$(ip netns exec "${NETNS}" nstat -az | \
> grep TcpExtTCPFastOpenPassiveFail | awk '{print $2}')
> - if [ $val -ne 0 ]; then
> + if [ "$val" -ne 0 ]; then
Did you test this in the failing environment?
With a busybox shell, I get:
$ [ "" -ne 0 ]
sh: bad number
You might need to explicitly check for empty string here, or switch to a string comparison instead:
if [ "$val" != 0 ]; then
-- Tim
> echo "FAIL: TcpExtTCPFastOpenPassiveFail non-zero"
> return 1
> fi
> --
> 2.20.1
Powered by blists - more mailing lists