* [PATCH iproute2-next] bash-completion: devlink: Fix dev completion trailing colon
@ 2026-04-26 11:51 Danielle Ratson
0 siblings, 0 replies; only message in thread
From: Danielle Ratson @ 2026-04-26 11:51 UTC (permalink / raw)
To: netdev; +Cc: jiri, dsahern, Danielle Ratson
Cited commit extended 'devlink dev show' to print the instance index when
the kernel provides DEVLINK_ATTR_INDEX, printing the device handle followed
by a colon and the index. The completion code was using the raw text output
as a word list, causing the device handle to be offered with a trailing
colon, e.g. "pci/0000:01:00.0:" instead of "pci/0000:01:00.0".
Switch to JSON output and extract device names using jq, consistent
with how port completion already works, to reliably get only the device
handle names regardless of what additional attributes are printed.
Fixes: 36252727bfc6 ("devlink: show devlink instance index in dev output")
Signed-off-by: Danielle Ratson <danieller@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
---
bash-completion/devlink | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/bash-completion/devlink b/bash-completion/devlink
index c053d3d0..7ec6a7cb 100644
--- a/bash-completion/devlink
+++ b/bash-completion/devlink
@@ -31,7 +31,8 @@ _devlink_direct_complete()
case $1 in
dev)
- value=$(devlink dev show 2>/dev/null)
+ value=$(devlink -j dev show 2>/dev/null \
+ | jq -r '.dev | keys[]')
;;
selftests_id)
dev=${words[4]}
--
2.51.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-04-26 11:52 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-26 11:51 [PATCH iproute2-next] bash-completion: devlink: Fix dev completion trailing colon Danielle Ratson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox