[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87qzqr5ktl.fsf@nvidia.com>
Date: Wed, 11 Feb 2026 17:01:09 +0100
From: Petr Machata <petrm@...dia.com>
To: Yue Haibing <yuehaibing@...wei.com>
CC: <davem@...emloft.net>, <edumazet@...gle.com>, <kuba@...nel.org>,
<pabeni@...hat.com>, <horms@...nel.org>, <shuah@...nel.org>,
<petrm@...dia.com>, <razor@...ckwall.org>, <netdev@...r.kernel.org>,
<linux-kselftest@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH net] selftests: net: lib: Fix jq parsing error
Yue Haibing <yuehaibing@...wei.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@...wei.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@...dia.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 ]]
> }
Powered by blists - more mailing lists