Subject: Re: Zsh Completion - Bug report
From: Daniel Shahaf <[email-masked]>
To: Stefano Balzan <[email-masked]>
Cc: [email-masked]
Date: Fri, 19 Aug 2016 15:58:29 +0000
List-Id: Zsh Workers List <zsh-workers.zsh.org>

Stefano Balzan wrote on Fri, Aug 19, 2016 at 12:10:02 +0200:
> Hello,
> I've probably found a bug in the 'ip neigh' commands set.
> Zsh completion sugguests using 'lladr' instead of 'lladdr' resulting in the
> following error:
> "Error: either "to" is duplicate, or "lladr" is a garbage."
> 
> It took me a while to find the subtle difference, since I rarely use the ip
> tools and it could be misleading for several users.

Thanks:

diff --git Completion/Unix/Command/_ip Completion/Unix/Command/_ip
index 1e39491..9833cdb 100644
--- Completion/Unix/Command/_ip
+++ Completion/Unix/Command/_ip
@@ -285,7 +285,7 @@ local -a neigh_add_cmds
 _regex_words neigh-add-commands "neighbour add command" \
   't*o:add new neighbour IP address:$subcmd_ipaddr' \
   'dev:specify network device:$subcmd_dev' \
-  'l*ladr:specify link layer (MAC) address or null:$subcmd_lladdr' \
+  'l*ladrr:specify link layer (MAC) address or null:$subcmd_lladdr' \
   'n*ud:specify neighbour unreachability detection state:$subcmd_nud'
 # to-address without keyword can appear first
 neigh_add_cmds=( "(" $subcmd_ipaddr "|" ")" "$reply[@]" "#")

One other issue: the man page synopsis is
.
       ip neigh { add | del | change | replace } { ADDR [ lladdr LLADDR ] … } …
.
but the word "lladdrr" is completed at argv[3], not at argv[4] as I'd
expect from the synopsis.  I'm not familiar with ip(8) so I'll leave
investigating this to someone else...

Cheers,

Daniel