You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
various errors resulting from str.startswith() matching empty string #77
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.
changed the title [-]various errors caused resulting from `str.startswith()` matching empty string[/-][+]various errors resulting from `str.startswith()` matching empty string[/+]on Mar 13, 2026
Activity
[-]various errors caused resulting from `str.startswith()` matching empty string[/-][+]various errors resulting from `str.startswith()` matching empty string[/+]brona commentedon Mar 28, 2026
I think 28e8dc3 should do it, feel free to have a look / review.
Adjust parsing logic, fixes brona#77