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

Crash when scanning a directory with "*" subdirectory #10200

Closed
rotem-cider opened this issue Oct 20, 2021 · 0 comments · Fixed by #10201
Closed

Crash when scanning a directory with "*" subdirectory #10200

rotem-cider opened this issue Oct 20, 2021 · 0 comments · Fixed by #10201
Labels

Comments

@rotem-cider
Copy link

rotem-cider commented Oct 20, 2021

Expected behavior

When scanning a directory the scanner should not crash

Actual behavior

When running on a directory with a "*" subdirectory scanner crashes

/Library/Ruby/Gems/2.6.0/gems/rubocop-1.12.0/lib/rubocop/target_finder.rb:106:in `flat_map'
/Library/Ruby/Gems/2.6.0/gems/rubocop-1.12.0/lib/rubocop/target_finder.rb:106:in `wanted_dir_patterns'
/Library/Ruby/Gems/2.6.0/gems/rubocop-1.12.0/lib/rubocop/target_finder.rb:91:in `find_files'
/Library/Ruby/Gems/2.6.0/gems/rubocop-1.12.0/lib/rubocop/target_finder.rb:61:in `target_files_in_dir'
/Library/Ruby/Gems/2.6.0/gems/rubocop-1.12.0/lib/rubocop/target_finder.rb:34:in `find'
/Library/Ruby/Gems/2.6.0/gems/rubocop-1.12.0/lib/rubocop/runner.rb:77:in `find_target_files'
/Library/Ruby/Gems/2.6.0/gems/rubocop-1.12.0/lib/rubocop/runner.rb:42:in `run'
/Library/Ruby/Gems/2.6.0/gems/rubocop-1.12.0/lib/rubocop/cli/command/execute_runner.rb:26:in `block in execute_runner'
/Library/Ruby/Gems/2.6.0/gems/rubocop-1.12.0/lib/rubocop/cli/command/execute_runner.rb:52:in `with_redirect'
/Library/Ruby/Gems/2.6.0/gems/rubocop-1.12.0/lib/rubocop/cli/command/execute_runner.rb:25:in `execute_runner'
/Library/Ruby/Gems/2.6.0/gems/rubocop-1.12.0/lib/rubocop/cli/command/execute_runner.rb:17:in `run'

Steps to reproduce the problem

mkdir "*"
rubocop --debug

RuboCop version

Include the output of rubocop -V or bundle exec rubocop -V if using Bundler.
If you see extension cop versions (e.g. rubocop-performance, rubocop-rspec, and others)
output by rubocop -V, include them as well. Here's an example:

rubocop -V
warning: parser/current is loading parser/ruby26, which recognizes
warning: 2.6.6-compliant syntax, but you are running 2.6.3.
warning: please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
1.12.0 (using Parser 3.0.0.0, rubocop-ast 1.4.1, running on ruby 2.6.3 universal.x86_64-darwin20)
@rotem-cider rotem-cider changed the title Crash when scanning a directory with " Crash when scanning a directory with "*" subdirectory Oct 20, 2021
@koic koic added the bug label Oct 20, 2021
koic added a commit to koic/rubocop that referenced this issue Oct 20, 2021
Fixes rubocop#10200.

This PR fixes an error when inspecting a directory named `*`.
bbatsov pushed a commit that referenced this issue Oct 20, 2021
Fixes #10200.

This PR fixes an error when inspecting a directory named `*`.
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