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

Invalid option values are silently ignored #675

Closed
reima opened this issue Oct 24, 2020 · 3 comments · Fixed by #676
Closed

Invalid option values are silently ignored #675

reima opened this issue Oct 24, 2020 · 3 comments · Fixed by #676
Assignees
Labels

Comments

@reima
Copy link
Contributor

reima commented Oct 24, 2020

Describe the bug you encountered:
When supplying an invalid value to an option that expects a numeric value, fd silently ignores that option.

For example, fd --max-depth x silently ignores the --max-depth option.

At least the following options are affected:

  • --min-depth
  • --max-depth (--maxdepth)
  • --exact-depth
  • --threads
  • --max-buffer-time
  • --max-results

Describe what you expected to happen:
I expected fd to exit with an error message saying the option value is invalid.

What version of fd are you using?
fd 8.1.1

Which operating system / distribution are you on?
Windows 10 (Version 2004, Build 19041.572)

@reima reima added the bug label Oct 24, 2020
@sharkdp
Copy link
Owner

sharkdp commented Oct 25, 2020

Thank you very much for reporting this. That should definitely be fixed.

I actually made a similar change to my hyperfine program recently (sharkdp/hyperfine#338), which suffered from a similar problem.

@sharkdp
Copy link
Owner

sharkdp commented Oct 25, 2020

Should be fixed in #676:

▶ fd --max-depth x          
[fd error]: Failed to parse argument to --max-depth/--exact-depth: invalid digit found in string

▶ fd --max-depth ''
[fd error]: Failed to parse argument to --max-depth/--exact-depth: cannot parse integer from empty string

▶ fd --threads=a   
[fd error]: Failed to parse number of threads: invalid digit found in string

▶ fd --threads=0
[fd error]: Number of threads must be positive.

@sharkdp
Copy link
Owner

sharkdp commented Dec 6, 2020

fix released in v8.2.0.

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

Successfully merging a pull request may close this issue.

2 participants