bash-completion: devlink: Fix dev completion trailing colon
Subsystems (2)
PATCH 1/1 bash-completion: devlink: Fix dev completion trailing colon
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.
--- bash-completion/devlink | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
bash-completion/devlink +2 -1
@@ -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]}
Signature · 1 line
2.51.0
This patch was applied to iproute2/iproute2-next.git (main) by David Ahern <[email protected]>:
Hello:
This patch was applied to iproute2/iproute2-next.git (main) by David Ahern <[email protected]>:
Quoted 11 lines · On Sun, 26 Apr 2026 14:51:39 +0300 you wrote:
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.
[...]
Here is the summary with links:
- [iproute2-next] bash-completion: devlink: Fix dev completion trailing colon
https://git.kernel.org/pub/scm/network/iproute2/iproute2-next.git/commit/?id=03b33c7550e9
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html