[Xorp-hackers] Possible fix for XORP bug 603
Pavlin Radoslavov
pavlin@icir.org
Thu, 27 Apr 2006 13:25:08 -0700
> You may get an invalid <[Enter]> and | options in help, as in:
>
> DUT-2> show ospf4 ?
> Possible completions:
> <[Enter]> Execute this command <==***Should not be displayed***
> database Show LSA database
> neighbor Show Neighbors
> | Pipe through this command <==***Should not be displayed***
>
> As these command fail with "ERROR: no matching command" if the
> command is executed, I've come up with possible fix which only
> displays these options if the command is valid, using the same
> mechanism as that which generated the error message in the first
> place.
>
> In cli_client.cc, add the command validation:
<DEL>
> and add the validator functions to op_commands:
<DEL>
> Finally, there's a global variable to tie the two together:
<DEL>
> What I don't like about this is that it requires a global variable
> to access the command list from the help function. What I do like
> about this is that it works!
>
> Suggestions? Alternatives? Just do it? :-)
Just don't do it please :)
* Global variables are bad and should be avoid unless there is no
other solution.
* The patch introduces an "interesting" dependency: the libcli
library becomes dependent on the xorpsh/rtrmgr code.
* The real problem was somewhere else and the bogus command-line
completion for the "show ospf4" command was a side effect of that
problem. This problem is now fixed in CVS.
See XORP Bugzilla entry #603 for details:
http://www.xorp.org/bugzilla/show_bug.cgi?id=603
Pavlin