public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] selftests: net: lib: Fix jq parsing error
@ 2026-02-11  2:21 Yue Haibing
  2026-02-11 16:01 ` Petr Machata
  2026-02-13  2:50 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 5+ messages in thread
From: Yue Haibing @ 2026-02-11  2:21 UTC (permalink / raw)
  To: davem, edumazet, kuba, pabeni, horms, shuah, petrm, razor
  Cc: netdev, linux-kselftest, linux-kernel, yuehaibing

The testcase failed as below:
$./vlan_bridge_binding.sh
...
+ adf_ip_link_set_up d1
+ local name=d1
+ shift
+ ip_link_is_up d1
+ ip_link_has_flag d1 UP
+ local name=d1
+ shift
+ local flag=UP
+ shift
++ ip -j link show d1
++ jq --arg flag UP 'any(.[].flags.[]; . == $flag)'
jq: error: syntax error, unexpected '[', expecting FORMAT or QQSTRING_START
 (Unix shell quoting issues?) at <top-level>, line 1:
any(.[].flags.[]; . == $flag)
jq: 1 compile error

Remove the extra dot (.) after flags array to fix this.

Fixes: 4baa1d3a5080 ("selftests: net: lib: Add ip_link_has_flag()")
Signed-off-by: Yue Haibing <yuehaibing@huawei.com>
---
 tools/testing/selftests/net/lib.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/net/lib.sh b/tools/testing/selftests/net/lib.sh
index 0ec131b339bc..b40694573f4c 100644
--- a/tools/testing/selftests/net/lib.sh
+++ b/tools/testing/selftests/net/lib.sh
@@ -577,7 +577,7 @@ ip_link_has_flag()
 	local flag=$1; shift
 
 	local state=$(ip -j link show "$name" |
-		      jq --arg flag "$flag" 'any(.[].flags.[]; . == $flag)')
+		      jq --arg flag "$flag" 'any(.[].flags[]; . == $flag)')
 	[[ $state == true ]]
 }
 
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net] selftests: net: lib: Fix jq parsing error
  2026-02-11  2:21 [PATCH net] selftests: net: lib: Fix jq parsing error Yue Haibing
@ 2026-02-11 16:01 ` Petr Machata
  2026-02-12  1:20   ` Yue Haibing
  2026-02-13  2:50 ` patchwork-bot+netdevbpf
  1 sibling, 1 reply; 5+ messages in thread
From: Petr Machata @ 2026-02-11 16:01 UTC (permalink / raw)
  To: Yue Haibing
  Cc: davem, edumazet, kuba, pabeni, horms, shuah, petrm, razor, netdev,
	linux-kselftest, linux-kernel


Yue Haibing <yuehaibing@huawei.com> writes:

> The testcase failed as below:
> $./vlan_bridge_binding.sh
> ...
> + adf_ip_link_set_up d1
> + local name=d1
> + shift
> + ip_link_is_up d1
> + ip_link_has_flag d1 UP
> + local name=d1
> + shift
> + local flag=UP
> + shift
> ++ ip -j link show d1
> ++ jq --arg flag UP 'any(.[].flags.[]; . == $flag)'
> jq: error: syntax error, unexpected '[', expecting FORMAT or QQSTRING_START
>  (Unix shell quoting issues?) at <top-level>, line 1:
> any(.[].flags.[]; . == $flag)
> jq: 1 compile error
>
> Remove the extra dot (.) after flags array to fix this.
>
> Fixes: 4baa1d3a5080 ("selftests: net: lib: Add ip_link_has_flag()")
> Signed-off-by: Yue Haibing <yuehaibing@huawei.com>

Interesting, both work for me on 1.7.1. What jq version do you use?

Nevertheless, I believe the fix is correct.

Reviewed-by: Petr Machata <petrm@nvidia.com>

> ---
>  tools/testing/selftests/net/lib.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/net/lib.sh b/tools/testing/selftests/net/lib.sh
> index 0ec131b339bc..b40694573f4c 100644
> --- a/tools/testing/selftests/net/lib.sh
> +++ b/tools/testing/selftests/net/lib.sh
> @@ -577,7 +577,7 @@ ip_link_has_flag()
>  	local flag=$1; shift
>  
>  	local state=$(ip -j link show "$name" |
> -		      jq --arg flag "$flag" 'any(.[].flags.[]; . == $flag)')
> +		      jq --arg flag "$flag" 'any(.[].flags[]; . == $flag)')
>  	[[ $state == true ]]
>  }


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net] selftests: net: lib: Fix jq parsing error
  2026-02-11 16:01 ` Petr Machata
@ 2026-02-12  1:20   ` Yue Haibing
  2026-02-12  9:51     ` Petr Machata
  0 siblings, 1 reply; 5+ messages in thread
From: Yue Haibing @ 2026-02-12  1:20 UTC (permalink / raw)
  To: Petr Machata
  Cc: davem, edumazet, kuba, pabeni, horms, shuah, razor, netdev,
	linux-kselftest, linux-kernel

On 2026/2/12 0:01, Petr Machata wrote:
> 
> Yue Haibing <yuehaibing@huawei.com> writes:
> 
>> The testcase failed as below:
>> $./vlan_bridge_binding.sh
>> ...
>> + adf_ip_link_set_up d1
>> + local name=d1
>> + shift
>> + ip_link_is_up d1
>> + ip_link_has_flag d1 UP
>> + local name=d1
>> + shift
>> + local flag=UP
>> + shift
>> ++ ip -j link show d1
>> ++ jq --arg flag UP 'any(.[].flags.[]; . == $flag)'
>> jq: error: syntax error, unexpected '[', expecting FORMAT or QQSTRING_START
>>  (Unix shell quoting issues?) at <top-level>, line 1:
>> any(.[].flags.[]; . == $flag)
>> jq: 1 compile error
>>
>> Remove the extra dot (.) after flags array to fix this.
>>
>> Fixes: 4baa1d3a5080 ("selftests: net: lib: Add ip_link_has_flag()")
>> Signed-off-by: Yue Haibing <yuehaibing@huawei.com>
> 
> Interesting, both work for me on 1.7.1. What jq version do you use?

I run this on Ubuntu 23.04,
jq - commandline JSON processor [version 1.6]
> 
> Nevertheless, I believe the fix is correct.
> 
> Reviewed-by: Petr Machata <petrm@nvidia.com>
> 
>> ---
>>  tools/testing/selftests/net/lib.sh | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/tools/testing/selftests/net/lib.sh b/tools/testing/selftests/net/lib.sh
>> index 0ec131b339bc..b40694573f4c 100644
>> --- a/tools/testing/selftests/net/lib.sh
>> +++ b/tools/testing/selftests/net/lib.sh
>> @@ -577,7 +577,7 @@ ip_link_has_flag()
>>  	local flag=$1; shift
>>  
>>  	local state=$(ip -j link show "$name" |
>> -		      jq --arg flag "$flag" 'any(.[].flags.[]; . == $flag)')
>> +		      jq --arg flag "$flag" 'any(.[].flags[]; . == $flag)')
>>  	[[ $state == true ]]
>>  }
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net] selftests: net: lib: Fix jq parsing error
  2026-02-12  1:20   ` Yue Haibing
@ 2026-02-12  9:51     ` Petr Machata
  0 siblings, 0 replies; 5+ messages in thread
From: Petr Machata @ 2026-02-12  9:51 UTC (permalink / raw)
  To: Yue Haibing
  Cc: Petr Machata, davem, edumazet, kuba, pabeni, horms, shuah, razor,
	netdev, linux-kselftest, linux-kernel


Yue Haibing <yuehaibing@huawei.com> writes:

> On 2026/2/12 0:01, Petr Machata wrote:
>> 
>> Yue Haibing <yuehaibing@huawei.com> writes:
>> 
>>> ++ jq --arg flag UP 'any(.[].flags.[]; . == $flag)'
>>> jq: error: syntax error, unexpected '[', expecting FORMAT or QQSTRING_START
>>>  (Unix shell quoting issues?) at <top-level>, line 1:
>>> any(.[].flags.[]; . == $flag)
>>> jq: 1 compile error
>>>
>>> Remove the extra dot (.) after flags array to fix this.
>> 
>> Interesting, both work for me on 1.7.1. What jq version do you use?
>
> I run this on Ubuntu 23.04,
> jq - commandline JSON processor [version 1.6]

Hmm, I see, 1.6 doesn't seem to have accepted the syntax.
Thanks for the fix!

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net] selftests: net: lib: Fix jq parsing error
  2026-02-11  2:21 [PATCH net] selftests: net: lib: Fix jq parsing error Yue Haibing
  2026-02-11 16:01 ` Petr Machata
@ 2026-02-13  2:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-02-13  2:50 UTC (permalink / raw)
  To: Yue Haibing
  Cc: davem, edumazet, kuba, pabeni, horms, shuah, petrm, razor, netdev,
	linux-kselftest, linux-kernel

Hello:

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

On Wed, 11 Feb 2026 10:21:46 +0800 you wrote:
> The testcase failed as below:
> $./vlan_bridge_binding.sh
> ...
> + adf_ip_link_set_up d1
> + local name=d1
> + shift
> + ip_link_is_up d1
> + ip_link_has_flag d1 UP
> + local name=d1
> + shift
> + local flag=UP
> + shift
> ++ ip -j link show d1
> ++ jq --arg flag UP 'any(.[].flags.[]; . == $flag)'
> jq: error: syntax error, unexpected '[', expecting FORMAT or QQSTRING_START
>  (Unix shell quoting issues?) at <top-level>, line 1:
> any(.[].flags.[]; . == $flag)
> jq: 1 compile error
> 
> [...]

Here is the summary with links:
  - [net] selftests: net: lib: Fix jq parsing error
    https://git.kernel.org/netdev/net/c/10ec0fc0ccc5

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



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-02-13  2:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-11  2:21 [PATCH net] selftests: net: lib: Fix jq parsing error Yue Haibing
2026-02-11 16:01 ` Petr Machata
2026-02-12  1:20   ` Yue Haibing
2026-02-12  9:51     ` Petr Machata
2026-02-13  2:50 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox