1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/lib/bundler/compact_index_client
David Rodríguez 76de7a92b9 [rubygems/rubygems] Fix misleading error if compact index cannot be copied
Previously if `~/.bundle/cache/compact_index/rubygems.org.*/version`
were owned by root with read-only access, `bundle install` would fail
with a misleading error message. For example:

```
There was an error while trying to write to `/tmp/bundler-compact-index-20220711-1823-npllre/versions`. It is
likely that you need to grant write permissions for that path.
```

This happened because the EACCESS error was caught by
`SharedHelpers.filesystem_access`, which makes it look like the target
directory is at fault instead of the source.

We can't simply drop this guard because that causes the opposite
problem: the permission error appears to come from the source instead of
the target, since `CompactIndexClient::Cache#lines` also wraps read
access errors.

Instead, bring a minimal implementation of `FileUtils.cp` and nest calls
to `SharedHelpers.filesystem_access` properly.

https://github.com/rubygems/rubygems/commit/320822c070

Co-authored-by: Stan Hu <stanhu@gmail.com>
2022-07-14 15:06:09 +09:00
..
cache.rb Merge rubygems/rubygems HEAD. 2022-01-19 15:01:44 +09:00
gem_parser.rb
updater.rb [rubygems/rubygems] Fix misleading error if compact index cannot be copied 2022-07-14 15:06:09 +09:00