diff mbox series

[v2] selftests: net: tcp_fastopen_backup_key.sh: fix shellcheck issue

Message ID 20190815075826.13210-1-anders.roxell@linaro.org
State Accepted
Commit 2aafdf5a5786ebbd8ccfe132ed6267c6962c5c3c
Headers show
Series [v2] selftests: net: tcp_fastopen_backup_key.sh: fix shellcheck issue | expand

Commit Message

Anders Roxell Aug. 15, 2019, 7:58 a.m. UTC
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 do a string comparison instead.

Signed-off-by: Anders Roxell <anders.roxell@linaro.org>

---
 tools/testing/selftests/net/tcp_fastopen_backup_key.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.20.1

Comments

David Miller Aug. 15, 2019, 6:34 p.m. UTC | #1
From: Anders Roxell <anders.roxell@linaro.org>

Date: Thu, 15 Aug 2019 09:58:26 +0200

> 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 do a string comparison instead.

> 

> Signed-off-by: Anders Roxell <anders.roxell@linaro.org>


Applied.
diff mbox series

Patch

diff --git a/tools/testing/selftests/net/tcp_fastopen_backup_key.sh b/tools/testing/selftests/net/tcp_fastopen_backup_key.sh
index 41476399e184..f6e65674b83c 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" != 0 ]; then
 		echo "FAIL: TcpExtTCPFastOpenPassiveFail non-zero"
 		return 1
 	fi