Skip to contentSkip to conversation

tools: ynl: cli: order set->list conversion in JSON output

PATCH Applied Jakub Kicinski 2 participants 2 messages Mar 7 – Mar 11

Subsystems (3)
lore
Share & tools
lore

Jakub Kicinski

author maintainer
#0 lore raw

PATCH 1/1 tools: ynl: cli: order set->list conversion in JSON output

NIPA tries to make sure that HW tests don't modify system state. It dumps some well known configs before and after the test and compares the outputs.

Make sure that YNL json output is stable. Converting sets to lists with a naive list(o) results in a random order.

---
CC: [email protected]
CC: [email protected]
CC: [email protected]

---
 tools/net/ynl/pyynl/cli.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/net/ynl/pyynl/cli.py +1 -1
index 94a5ba348b69..b452d4fb9434 100755
@@ -78,7 +78,7 @@ RELATIVE_SCHEMA_DIR='../../../../Documentation/netlink'
         if isinstance(o, bytes):
             return bytes.hex(o)
         if isinstance(o, set):
-            return list(o)
+            return sorted(o)
         return json.JSONEncoder.default(self, o)
 
 
Signature · 1 line
2.53.0
#1 lore raw
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Sat, 7 Mar 2026 09:59:16 -0800 you wrote:

NIPA tries to make sure that HW tests don't modify system state. It dumps some well known configs before and after the test and compares the outputs.

Make sure that YNL json output is stable. Converting sets to lists with a naive list(o) results in a random order.

[...]

Here is the summary with links:
- [net-next] tools: ynl: cli: order set->list conversion in JSON output

    https://git.kernel.org/netdev/net-next/c/b8a0e5eb6a12

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html