🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
4 messages
4 total messages Started by "Jin Li" Tue, 10 Nov 2026 02:41
[PATCH net v2] selftests: net: forwarding: replace bash brace expansion with seq
#13570
Author: "Jin Li"
Date: Tue, 10 Nov 2026 02:41
79 lines
11635 bytes
{1..16384} is bash-specific brace expansion and will not work with POSIX
shells like dash or busybox ash. This breaks the flowlabel test when
/bin/sh is not bash.

Use $(seq 1 16384) for portable iteration. Fix the same issue in
custom_multipath_hash.sh, gre_custom_multipath_hash.sh and
ip6gre_custom_multipath_hash.sh.

Fixes: 555e5531635a ("selftests: net/forwarding: spawn sh inside vrf to speed up ping loop")
Signed-off-by: Jin Li <jinli@lanxincomputing.com>
---
v2:
- Add Fixes tag

 .../selftests/net/forwarding/custom_multipath_hash.sh     | 8 ++++----
 .../selftests/net/forwarding/gre_custom_multipath_hash.sh | 8 ++++----
 .../net/forwarding/ip6gre_custom_multipath_hash.sh        | 8 ++++----
 3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/tools/testing/selftests/net/forwarding/custom_multipath_hash.sh b/tools/testing/selftests/net/forwarding/custom_multipath_hash.sh
index 5dbfab0e2..92940370e 100755
--- a/tools/testing/selftests/net/forwarding/custom_multipath_hash.sh
+++ b/tools/testing/selftests/net/forwarding/custom_multipath_hash.sh
@@ -224,10 +224,10 @@ send_dst_ipv6()
 send_flowlabel()
 {
 	# Generate 16384 echo requests, each with a random flow label.
-	ip vrf exec v$h1 sh -c \
-		"for _ in {1..16384}; do \
-			$PING6 -F 0 -c 1 -q 2001:db8:4::2 >/dev/null 2>&1; \
-		done"
+	ip vrf exec v$h1 sh -c '
+		for _ in $(seq 1 16384); do
+			'"$PING6"' -F 0 -c 1 -q 2001:db8:4::2 >/dev/null 2>&1
+		done'
 }
 
 send_src_udp6()
diff --git a/tools/testing/selftests/net/forwarding/gre_custom_multipath_hash.sh b/tools/testing/selftests/net/forwarding/gre_custom_multipath_hash.sh
index b4f17a5bb..19384be4b 100755
--- a/tools/testing/selftests/net/forwarding/gre_custom_multipath_hash.sh
+++ b/tools/testing/selftests/net/forwarding/gre_custom_multipath_hash.sh
@@ -319,10 +319,10 @@ send_dst_ipv6()
 send_flowlabel()
 {
 	# Generate 16384 echo requests, each with a random flow label.
-	ip vrf exec v$h1 sh -c \
-		"for _ in {1..16384}; do \
-			$PING6 -F 0 -c 1 -q 2001:db8:2::2 >/dev/null 2>&1; \
-		done"
+	ip vrf exec v$h1 sh -c '
+		for _ in $(seq 1 16384); do
+			'"$PING6"' -F 0 -c 1 -q 2001:db8:2::2 >/dev/null 2>&1
+		done'
 }
 
 send_src_udp6()
diff --git a/tools/testing/selftests/net/forwarding/ip6gre_custom_multipath_hash.sh b/tools/testing/selftests/net/forwarding/ip6gre_custom_multipath_hash.sh
index b24acfa52..d848e82d4 100755
--- a/tools/testing/selftests/net/forwarding/ip6gre_custom_multipath_hash.sh
+++ b/tools/testing/selftests/net/forwarding/ip6gre_custom_multipath_hash.sh
@@ -321,10 +321,10 @@ send_dst_ipv6()
 send_flowlabel()
 {
 	# Generate 16384 echo requests, each with a random flow label.
-	ip vrf exec v$h1 sh -c \
-		"for _ in {1..16384}; do \
-			$PING6 -F 0 -c 1 -q 2001:db8:2::2 >/dev/null 2>&1; \
-		done"
+	ip vrf exec v$h1 sh -c '
+		for _ in $(seq 1 16384); do
+			'"$PING6"' -F 0 -c 1 -q 2001:db8:2::2 >/dev/null 2>&1
+		done'
 }
 
 send_src_udp6()
-- 
2.53.0
Re: [PATCH net v2] selftests: net: forwarding: replace bash brace expansion with seq
#14359
Author: Hangbin Liu
Date: Wed, 11 Nov 2026 01:32
82 lines
11495 bytes
On Tue, Nov 10, 2026 at 10:41:23AM +0800, Jin Li wrote:
> {1..16384} is bash-specific brace expansion and will not work with POSIX
> shells like dash or busybox ash. This breaks the flowlabel test when
> /bin/sh is not bash.
> 
> Use $(seq 1 16384) for portable iteration. Fix the same issue in
> custom_multipath_hash.sh, gre_custom_multipath_hash.sh and
> ip6gre_custom_multipath_hash.sh.
> 
> Fixes: 555e5531635a ("selftests: net/forwarding: spawn sh inside vrf to speed up ping loop")
> Signed-off-by: Jin Li <jinli@lanxincomputing.com>
> ---
> v2:
> - Add Fixes tag
> 
>  .../selftests/net/forwarding/custom_multipath_hash.sh     | 8 ++++----
>  .../selftests/net/forwarding/gre_custom_multipath_hash.sh | 8 ++++----
>  .../net/forwarding/ip6gre_custom_multipath_hash.sh        | 8 ++++----
>  3 files changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/tools/testing/selftests/net/forwarding/custom_multipath_hash.sh b/tools/testing/selftests/net/forwarding/custom_multipath_hash.sh
> index 5dbfab0e2..92940370e 100755
> --- a/tools/testing/selftests/net/forwarding/custom_multipath_hash.sh
> +++ b/tools/testing/selftests/net/forwarding/custom_multipath_hash.sh
> @@ -224,10 +224,10 @@ send_dst_ipv6()
>  send_flowlabel()
>  {
>  	# Generate 16384 echo requests, each with a random flow label.
> -	ip vrf exec v$h1 sh -c \
> -		"for _ in {1..16384}; do \
> -			$PING6 -F 0 -c 1 -q 2001:db8:4::2 >/dev/null 2>&1; \
> -		done"
> +	ip vrf exec v$h1 sh -c '
> +		for _ in $(seq 1 16384); do
> +			'"$PING6"' -F 0 -c 1 -q 2001:db8:4::2 >/dev/null 2>&1
> +		done'
>  }
>  
>  send_src_udp6()
> diff --git a/tools/testing/selftests/net/forwarding/gre_custom_multipath_hash.sh b/tools/testing/selftests/net/forwarding/gre_custom_multipath_hash.sh
> index b4f17a5bb..19384be4b 100755
> --- a/tools/testing/selftests/net/forwarding/gre_custom_multipath_hash.sh
> +++ b/tools/testing/selftests/net/forwarding/gre_custom_multipath_hash.sh
> @@ -319,10 +319,10 @@ send_dst_ipv6()
>  send_flowlabel()
>  {
>  	# Generate 16384 echo requests, each with a random flow label.
> -	ip vrf exec v$h1 sh -c \
> -		"for _ in {1..16384}; do \
> -			$PING6 -F 0 -c 1 -q 2001:db8:2::2 >/dev/null 2>&1; \
> -		done"
> +	ip vrf exec v$h1 sh -c '
> +		for _ in $(seq 1 16384); do
> +			'"$PING6"' -F 0 -c 1 -q 2001:db8:2::2 >/dev/null 2>&1
> +		done'
>  }
>  
>  send_src_udp6()
> diff --git a/tools/testing/selftests/net/forwarding/ip6gre_custom_multipath_hash.sh b/tools/testing/selftests/net/forwarding/ip6gre_custom_multipath_hash.sh
> index b24acfa52..d848e82d4 100755
> --- a/tools/testing/selftests/net/forwarding/ip6gre_custom_multipath_hash.sh
> +++ b/tools/testing/selftests/net/forwarding/ip6gre_custom_multipath_hash.sh
> @@ -321,10 +321,10 @@ send_dst_ipv6()
>  send_flowlabel()
>  {
>  	# Generate 16384 echo requests, each with a random flow label.
> -	ip vrf exec v$h1 sh -c \
> -		"for _ in {1..16384}; do \
> -			$PING6 -F 0 -c 1 -q 2001:db8:2::2 >/dev/null 2>&1; \
> -		done"
> +	ip vrf exec v$h1 sh -c '
> +		for _ in $(seq 1 16384); do
> +			'"$PING6"' -F 0 -c 1 -q 2001:db8:2::2 >/dev/null 2>&1
> +		done'
>  }
>  
>  send_src_udp6()
> -- 
> 2.53.0

Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn>
Re: [PATCH net v2] selftests: net: forwarding: replace bash brace expansion with seq
#14948
Author: Xia Yan
Date: Thu, 12 Nov 2026 07:58
16 lines
9359 bytes
On 11/10/26 02:41, Jin Li wrote:
> {1..16384} is bash-specific brace expansion and will not work with POSIX
> shells like dash or busybox ash. This breaks the flowlabel test when
> /bin/sh is not bash.

I ran both loop forms under dash and busybox ash. The old form
hands the inner shell a literal {1..16384}, so the loop body runs
once. With the patch it runs all 16384 iterations, and the spliced
$PING6 expands to the same command line as before.

555e5531635a replaced $(seq 1 16384) with {1..16384} in these
three scripts and nowhere else, so the Fixes tag is accurate. The
rest of the forwarding directory has no sh -c call sites.

Reviewed-by: Xia Yan <yanxia@cmss.chinamobile.com>
Re: [PATCH net v2] selftests: net: forwarding: replace bash brace expansion with seq
#15336
Author: patchwork-bot+netdevbpf
Date: Thu, 12 Nov 2026 17:20
25 lines
8731 bytes
Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Tue, 10 Nov 2026 10:41:23 +0800 you wrote:
> {1..16384} is bash-specific brace expansion and will not work with POSIX
> shells like dash or busybox ash. This breaks the flowlabel test when
> /bin/sh is not bash.
> 
> Use $(seq 1 16384) for portable iteration. Fix the same issue in
> custom_multipath_hash.sh, gre_custom_multipath_hash.sh and
> ip6gre_custom_multipath_hash.sh.
> 
> [...]

Here is the summary with links:
  - [net,v2] selftests: net: forwarding: replace bash brace expansion with seq
    https://git.kernel.org/netdev/net-next/c/e6edbf3e343c

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads