Discussion:
Zsh Completion - Bug report
Stefano Balzan
2016-08-19 10:10:02 UTC
Permalink
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.


Regards,
Stefano Balzan
Daniel Shahaf
2016-08-19 15:58:29 UTC
Permalink
Post by Stefano Balzan
Hello,
I've probably found a bug in the 'ip neigh' commands set.
Zsh completion sugguests using 'lladr' instead of 'lladdr' resulting in the
"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
Axel Beckert
2016-08-19 17:26:06 UTC
Permalink
Hi Daniel,
Post by Daniel Shahaf
Post by Stefano Balzan
Zsh completion sugguests using 'lladr' instead of 'lladdr' resulting in the
[...]
Post by Daniel Shahaf
- 'l*ladr:specify link layer (MAC) address or null:$subcmd_lladdr' \
+ 'l*ladrr:specify link layer (MAC) address or null:$subcmd_lladdr' \
^

There's a typo in your typo fix. Should be:

- 'l*ladr:specify link layer (MAC) address or null:$subcmd_lladdr' \
+ 'l*laddr:specify link layer (MAC) address or null:$subcmd_lladdr' \

Kind regards, Axel
--
/~\ Plain Text Ribbon Campaign | Axel Beckert
\ / Say No to HTML in E-Mail and News | ***@deuxchevaux.org (Mail)
X See http://www.nonhtmlmail.org/campaign.html | ***@noone.org (Mail+Jabber)
/ \ I love long mails: http://email.is-not-s.ms/ | http://abe.noone.org/ (Web)
Stefano Balzan
2016-08-19 18:03:50 UTC
Permalink
Thank you, I think your fix should do, pay attention to the typo Axel
pointed out though.
I'm no expert of the 'ip' command, anyway this is how I would add an arp
entry:

"ip neigh add 192.168.1.1 lladdr 12:34:56:78:ab:cd [other parameters]"

Probably the lladdr keyword (link layer address) should be suggested at
argv[4], but I'm not completely sure.

regards,
Stefano
Post by Axel Beckert
Hi Daniel,
Post by Daniel Shahaf
Post by Stefano Balzan
Zsh completion sugguests using 'lladr' instead of 'lladdr' resulting
in the
[...]
Post by Daniel Shahaf
- 'l*ladr:specify link layer (MAC) address or null:$subcmd_lladdr' \
+ 'l*ladrr:specify link layer (MAC) address or null:$subcmd_lladdr' \
^
- 'l*ladr:specify link layer (MAC) address or null:$subcmd_lladdr' \
+ 'l*laddr:specify link layer (MAC) address or null:$subcmd_lladdr' \
Kind regards, Axel
--
/~\ Plain Text Ribbon Campaign | Axel Beckert
(Mail)
/ \ I love long mails: http://email.is-not-s.ms/ | http://abe.noone.org/ (Web)
Daniel Shahaf
2016-08-20 03:07:38 UTC
Permalink
Post by Stefano Balzan
Thank you, I think your fix should do, pay attention to the typo Axel
pointed out though.
Pushed with the correction — thanks everyone for the reviews.
Post by Stefano Balzan
I'm no expert of the 'ip' command, anyway this is how I would add an arp
"ip neigh add 192.168.1.1 lladdr 12:34:56:78:ab:cd [other parameters]"
Probably the lladdr keyword (link layer address) should be suggested at
argv[4], but I'm not completely sure.
Thanks for the example. Currently, argv[4] in your command is completed
correctly but argv[3] completes as argv[4]; that is: completing argv[3]
offers lladdr and doesn't offer "an IP address".

It's probably not hard to fix, but I'll leave it to someone else...

Cheers,

Daniel

Bart Schaefer
2016-08-19 17:38:18 UTC
Permalink
On Aug 19, 3:58pm, Daniel Shahaf wrote:
}
} - 'l*ladr:specify link layer (MAC) address or null:$subcmd_lladdr' \
} + 'l*ladrr:specify link layer (MAC) address or null:$subcmd_lladdr' \

Isn't that STILL a typo? Should be l*laddr ?
Loading...