Page MenuHomeVyOS Platform

Completion helper list is not sorted
Open, LowPublicBUG


Imagine the following CML snippet:

<leafNode name="table-size">
    <help>Maximum number of entries to keep in the ARP cache</help>
      <list>1024 2048 4096 8192 16384 32768</list>
$ cat /opt/vyatta/share/vyatta-cfg/templates/system/ip/arp/table-size/node.def
type: txt
help: Maximum number of entries to keep in the ARP cache
allowed: echo "1024 2048 4096 8192 16384 32768"
syntax:expression: exec "${vyos_libexec_dir}/ --regex \'(1024|2048|4096|8192|16384|32768)\'  --value \'$VAR(@)\'"; "Invalid value"

But when using TAB for completin helper the values get mixed up:

vyos@vyos# set system ip arp table-size
Possible completions:
   <text>       Maximum number of entries to keep in the ARP cache


Difficulty level
Normal (likely a few hours)
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Unspecified (possibly destroys the router)
Issue type
Bug (incorrect behavior)

Event Timeline

Here fix

The above patch breaks sorting for other nodes that contain text, not a number. We'd need some way to distinguish different node types (text, IP, number,...) and chose different sorts depending on that.

The old command definitions had a value format that was read by the completion functions through _cli_shell_api_hitems. We'd need to make the new XML definitions also create numeric nodes with type u32., then we could treat different node types differently and apply different sorts.

jjakob triaged this task as Low priority.Apr 2 2020, 3:08 PM
erkin set Issue type to Bug (incorrect behavior).Aug 31 2021, 6:00 PM