From: Petr Machata <petrm@nvidia.com>
To: Yue Haibing <yuehaibing@huawei.com>
Cc: <davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>,
<pabeni@redhat.com>, <horms@kernel.org>, <shuah@kernel.org>,
<petrm@nvidia.com>, <razor@blackwall.org>,
<netdev@vger.kernel.org>, <linux-kselftest@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net] selftests: net: lib: Fix jq parsing error
Date: Wed, 11 Feb 2026 17:01:09 +0100 [thread overview]
Message-ID: <87qzqr5ktl.fsf@nvidia.com> (raw)
In-Reply-To: <20260211022146.190948-1-yuehaibing@huawei.com>
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 ]]
> }
next prev parent reply other threads:[~2026-02-11 16:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-11 2:21 [PATCH net] selftests: net: lib: Fix jq parsing error Yue Haibing
2026-02-11 16:01 ` Petr Machata [this message]
2026-02-12 1:20 ` Yue Haibing
2026-02-12 9:51 ` Petr Machata
2026-02-13 2:50 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87qzqr5ktl.fsf@nvidia.com \
--to=petrm@nvidia.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=razor@blackwall.org \
--cc=shuah@kernel.org \
--cc=yuehaibing@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.