Several places where str.startswith() is used misparse when "" is used as a parameter, because it matches the empty string (""):
ip addr "" is parsed as ip addr show
ip "" is parsed as ip addr
What iproute2 does:
% ip a ""
Command "" is unknown, try "ip address help".
% ip ""
Object "" is unknown, try "ip help".
Admittedly this is a degenerate case, and probably isn't too high of a priority.
I started working on these piecemeal, but the patch was getting messy. In most cases making sure that the string isn't "" is sufficient, but I found at least one case where that's still too lenient (ip link s is not allowed by iproute2 in my testing, but maddeningly, ip addr s is!!)
I may submit a patch for this, but probably not soon. I'd probably work on refactoring or unit tests first.
Several places where
str.startswith()is used misparse when""is used as a parameter, because it matches the empty string (""):ip addr ""is parsed asip addr showip ""is parsed asip addrWhat iproute2 does:
Admittedly this is a degenerate case, and probably isn't too high of a priority.
I started working on these piecemeal, but the patch was getting messy. In most cases making sure that the string isn't
""is sufficient, but I found at least one case where that's still too lenient (ip link sis not allowed by iproute2 in my testing, but maddeningly,ip addr sis!!)I may submit a patch for this, but probably not soon. I'd probably work on refactoring or unit tests first.