mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yue Haibing <yuehaibing@huawei.com>
To: Petr Machata <petrm@nvidia.com>
Cc: <davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>,
	<pabeni@redhat.com>, <horms@kernel.org>, <shuah@kernel.org>,
	<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: Thu, 12 Feb 2026 09:20:35 +0800	[thread overview]
Message-ID: <34e17499-e385-4017-801c-332c9c40d484@huawei.com> (raw)
In-Reply-To: <87qzqr5ktl.fsf@nvidia.com>

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 ]]
>>  }
> 

  reply	other threads:[~2026-02-12  1:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-11  2:21 Yue Haibing
2026-02-11 16:01 ` Petr Machata
2026-02-12  1:20   ` Yue Haibing [this message]
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=34e17499-e385-4017-801c-332c9c40d484@huawei.com \
    --to=yuehaibing@huawei.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=petrm@nvidia.com \
    --cc=razor@blackwall.org \
    --cc=shuah@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®