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

expr: unexpected argument error for missing arguments is misleading #5573

Closed
cakebaker opened this issue Nov 22, 2023 · 3 comments
Closed

expr: unexpected argument error for missing arguments is misleading #5573

cakebaker opened this issue Nov 22, 2023 · 3 comments
Labels

Comments

@cakebaker
Copy link
Contributor

The following commands lead to unexpected argument errors with uutils expr:

$ cargo run expr length
expr: syntax error: unexpected argument 'length'
$ cargo run expr index hello
expr: syntax error: unexpected argument 'index'
$ cargo run expr substr hello 1
expr: syntax error: unexpected argument 'substr'

This is a bit misleading because the problem is not the argument shown in the error message but missing arguments.

GNU expr shows a missing argument error in such cases:

$ expr length
expr: syntax error: missing argument after ‘length’
$ expr index hello
expr: syntax error: missing argument after ‘hello’
$ expr substr hello 1
expr: syntax error: missing argument after ‘1’
@Luv-Ray
Copy link
Contributor

Luv-Ray commented Nov 25, 2023

Now they all leading to expr: syntax error (premature end of expression) on the main branch of uutils:

$ cargo run expr length
expr: syntax error (premature end of expression)
$ cargo run expr index hello
expr: syntax error (premature end of expression)
$ cargo run expr substr hello 1
expr: syntax error (premature end of expression)

Is this acceptable?

@tertsdiepraam
Copy link
Member

That doesn't sound like the right behaviour. I'm reworking the parsing at the moment though. I'll try to get that PR up soon.

@tertsdiepraam
Copy link
Member

Fixed by #5586

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

3 participants