Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent error messages for out of range values #567

Open
devibinoy opened this issue Oct 15, 2024 · 1 comment
Open

Inconsistent error messages for out of range values #567

devibinoy opened this issue Oct 15, 2024 · 1 comment
Labels

Comments

@devibinoy
Copy link

set instance default protocol bgp timer keepalive 99999999999999999999
CLI syntax error: "set instance default protocol bgp timer keepalive 99999999999999999999": Number 99999999999999999999 out of data-type range: 0 - 18446744073709551615

set instance default protocol bgp timer keepalive 99999
CLI syntax error: "set instance default protocol bgp timer keepalive 99999": Number 99999 out of data-type range: 0 - 65535

Here, keepalive is of type uint16. The logic parses the input first as a broader type (uint64), and then as the specific type (uint16). However, the error messages are inconsistent between these stages for the same context.

@olofhagsand
Copy link
Member

The logic is done in match_variable: https://github.com/clicon/cligen/blob/68a0b407f5c4e1fd81191ad1eb8be5fe640ad03d/cligen_match.c#L92
It has to do with split functionality in the parse and validate functions making the range checks unnecessary complex.
One way to fix it could to add explicit range checks in the parse function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants