[BusyBox 0001076]: "ip addr del" does not work

bugs at busybox.net bugs at busybox.net
Wed Oct 25 16:36:27 UTC 2006


A NOTE has been added to this issue. 
====================================================================== 
http://busybox.net/bugs/view.php?id=1076 
====================================================================== 
Reported By:                Andreas Winter
Assigned To:                BusyBox
====================================================================== 
Project:                    BusyBox
Issue ID:                   1076
Category:                   Networking Support
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     assigned
====================================================================== 
Date Submitted:             10-25-2006 03:21 PDT
Last Modified:              10-25-2006 09:36 PDT
====================================================================== 
Summary:                    "ip addr del" does not work
Description: 
file: ipaddress.c

...
int do_ipaddr(int argc, char **argv)
{
	static const char *const commands[] = {
		"add", "delete", "list", "show", "lst", "flush", 0
	};
...
should be
...
int do_ipaddr(int argc, char **argv)
{
	static const char *const commands[] = {
		"add", "del", "list", "show", "lst", "flush", 0
	};
...
====================================================================== 

---------------------------------------------------------------------- 
 Andreas Winter - 10-25-06 03:26  
---------------------------------------------------------------------- 
To be more precise: del should work in addition to delete 

---------------------------------------------------------------------- 
 bernhardf - 10-25-06 09:01  
---------------------------------------------------------------------- 
I disagree. ip addr delete should still be supported, so you cannot simply
change "delete" to "del" there.

The attached snippet uses strncmp(,key,strlen(key)) rather than strcmp.
This does not catch ambiguous args when you compare the string_array.

For this to work, we'd need to keep track on how many matches we got and
bail if matches > 1.

For the ip applet, the strncmp thing should do it for now, though. 

---------------------------------------------------------------------- 
 Andreas Winter - 10-25-06 09:36  
---------------------------------------------------------------------- 
Hi bernardf,

I disagree, too ;-)
Unfortunately the function compare_string_array is used at many places.
Changing the semantics could break other code.
On solution might be to simply add "del" to the list of commands. But this
would reject "dele" and "delet" as unknown commands.
Or you can add a function compare_string_array_prefix which does what you
want and return -1 if the command is ambigious.
Unfortunately "del" is used in some (many?) scripts, which would break, if
this not fixed. 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
10-25-06 03:21  Andreas Winter New Issue                                    
10-25-06 03:21  Andreas Winter Status                   new => assigned     
10-25-06 03:21  Andreas Winter Assigned To               => BusyBox         
10-25-06 03:26  Andreas Winter Note Added: 0001718                          
10-25-06 08:58  bernhardf      File Added: busybox.bug1076.00.diff              
     
10-25-06 09:01  bernhardf      Note Added: 0001719                          
10-25-06 09:36  Andreas Winter Note Added: 0001720                          
======================================================================




More information about the busybox-cvs mailing list