Skip to contentSkip to conversation

selftest: net: Fix error message if empty variable

PATCH Applied Alessandro Zanni 3 participants 3 messages Sep 25, 2025 – Sep 26, 2025

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

PATCH v2 1/1 selftest: net: Fix error message if empty variable

Fix to avoid cases where the res shell variable is empty in script comparisons.
The comparison has been modified into string comparison to handle other possible values the variable could assume.

The issue can be reproduced with the command:
make kselftest TARGETS=net

It solves the error:
./tfo_passive.sh: line 98: [: -eq: unary operator expected

---

Notes:
v2: edit condition to handle strings

 tools/testing/selftests/net/tfo_passive.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/net/tfo_passive.sh +1 -1
index 80bf11fdc046..a4550511830a 100755
@@ -95,7 +95,7 @@ wait
 res=$(cat $out_file)
 rm $out_file
 
-if [ $res -eq 0 ]; then
+if [ "$res" = "0" ]; then
 	echo "got invalid NAPI ID from passive TFO socket"
 	cleanup_ns
 	exit 1
Signature · 1 line
2.43.0
reviewer Reviewed-by on v2 1/1
#1 lore raw
Quoted 8 lines · Alessandro Zanni

Fix to avoid cases where the res shell variable is empty in script comparisons.
The comparison has been modified into string comparison to handle other possible values the variable could assume.

The issue can be reproduced with the command:
make kselftest TARGETS=net

Quoted 8 lines

It solves the error:
./tfo_passive.sh: line 98: [: -eq: unary operator expected

---

Notes:
v2: edit condition to handle strings

Thanks. This seems more robust to me.

#2 lore raw
In reply to Alessandro Zanni
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 9 lines · On Thu, 25 Sep 2025 15:28:23 +0200 you wrote:

Fix to avoid cases where the res shell variable is empty in script comparisons.
The comparison has been modified into string comparison to handle other possible values the variable could assume.

The issue can be reproduced with the command:
make kselftest TARGETS=net

[...]

Here is the summary with links:
- [v2] selftest: net: Fix error message if empty variable

    https://git.kernel.org/netdev/net-next/c/81dcfdd21dbd

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html