Skip to contentSkip to conversation

selftests: net: tcp_fastopen_backup_key.sh: fix shellcheck issue

PATCH Applied Anders Roxell 2 participants 2 messages Aug 15, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 selftests: net: tcp_fastopen_backup_key.sh: fix shellcheck issue

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.

---
 tools/testing/selftests/net/tcp_fastopen_backup_key.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/net/tcp_fastopen_backup_key.sh +1 -1
index 41476399e184..f6e65674b83c 100755
@@ -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
Signature · 1 line
2.20.1
maintainer Applied
#1 lore raw

From: Anders Roxell <[email protected]>
Date: Thu, 15 Aug 2019 09:58:26 +0200

Quoted 7 lines

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
Quoted 7 lines

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.

Applied.