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

cache-root is required when cache is disabled #11725

Closed
seandilda opened this issue Mar 21, 2023 · 0 comments · Fixed by #11726
Closed

cache-root is required when cache is disabled #11725

seandilda opened this issue Mar 21, 2023 · 0 comments · Fixed by #11726
Labels

Comments

@seandilda
Copy link

rubocop will fail if it can't write to the cache-root directory even if you specify --cache=false


Expected behavior

When caching is disabled, rubocop should not crash if it can't write to the cache root.

Actual behavior

rubocop crashes with the error /usr/local/lib/ruby/3.1.0/fileutils.rb:243:in mkdir': Permission denied @ dir_s_mkdir - /.cache (Errno::EACCES)`

Steps to reproduce the problem

$ docker run --rm -it --user 1000 ruby:3.1 bash -c 'gem install rubocop && rubocop --debug --cache=false'          
Fetching rubocop-ast-1.27.0.gem
Fetching regexp_parser-2.7.0.gem
Fetching unicode-display_width-2.4.2.gem
Fetching rainbow-3.1.1.gem
Fetching ruby-progressbar-1.13.0.gem
Fetching ast-2.4.2.gem
Fetching parser-3.2.1.1.gem
Fetching parallel-1.22.1.gem
Fetching rubocop-1.48.1.gem
Successfully installed unicode-display_width-2.4.2
Successfully installed ruby-progressbar-1.13.0
Successfully installed ast-2.4.2
Successfully installed parser-3.2.1.1
Successfully installed rubocop-ast-1.27.0
Successfully installed regexp_parser-2.7.0
Successfully installed rainbow-3.1.1
Successfully installed parallel-1.22.1
Successfully installed rubocop-1.48.1
9 gems installed
/usr/local/lib/ruby/3.1.0/fileutils.rb:243:in `mkdir': Permission denied @ dir_s_mkdir - /.cache (Errno::EACCES)
	from /usr/local/lib/ruby/3.1.0/fileutils.rb:243:in `fu_mkdir'
	from /usr/local/lib/ruby/3.1.0/fileutils.rb:221:in `block (2 levels) in mkdir_p'
	from /usr/local/lib/ruby/3.1.0/fileutils.rb:219:in `reverse_each'
	from /usr/local/lib/ruby/3.1.0/fileutils.rb:219:in `block in mkdir_p'
	from /usr/local/lib/ruby/3.1.0/fileutils.rb:211:in `each'
	from /usr/local/lib/ruby/3.1.0/fileutils.rb:211:in `mkdir_p'
	from /usr/local/lib/ruby/3.1.0/pathname.rb:585:in `mkpath'
	from /usr/local/bundle/gems/rubocop-1.48.1/lib/rubocop/server/cache.rb:46:in `block in dir'
	from <internal:kernel>:90:in `tap'
	from /usr/local/bundle/gems/rubocop-1.48.1/lib/rubocop/server/cache.rb:45:in `dir'
	from /usr/local/bundle/gems/rubocop-1.48.1/lib/rubocop/server/cache.rb:98:in `pid_path'
	from /usr/local/bundle/gems/rubocop-1.48.1/lib/rubocop/server/cache.rb:118:in `pid_running?'
	from /usr/local/bundle/gems/rubocop-1.48.1/lib/rubocop/server.rb:36:in `running?'
	from /usr/local/bundle/gems/rubocop-1.48.1/exe/rubocop:11:in `<top (required)>'
	from /usr/local/bundle/bin/rubocop:25:in `load'
	from /usr/local/bundle/bin/rubocop:25:in `<main>'
@koic koic added the bug label Mar 22, 2023
koic added a commit to koic/rubocop that referenced this issue Mar 22, 2023
Fixes rubocop#11725.

This PR fixes an error when insufficient permissions to server cache dir are granted.
bbatsov pushed a commit that referenced this issue Mar 22, 2023
Fixes #11725.

This PR fixes an error when insufficient permissions to server cache dir are granted.
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