Skip to content

Commit

Permalink
Let original EACCES error be raised
Browse files Browse the repository at this point in the history
This block of code already wraps file operations with
`SharedHelpers.filesystem_access`, which rescues and re-raises more
friendly errors. Also, I'm not fully sure creating a temporary directory
can end up raising an `Errno::EACCES` error from reading `tmpdir`
sources. Finally, this rescue block apparently leads to some false
positives when firewall is blocking the ruby executable on Windows, or
at least that's what we've got reported.

In any case, I think it's best to let the original error be raised.
  • Loading branch information
deivid-rodriguez committed Nov 29, 2021
1 parent afddaff commit f7dbe54
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 15 deletions.
5 changes: 0 additions & 5 deletions bundler/lib/bundler/compact_index_client/updater.rb
Expand Up @@ -76,11 +76,6 @@ def update(local_path, remote_path, retrying = nil)

update(local_path, remote_path, :retrying)
end
rescue Errno::EACCES
raise Bundler::PermissionError,
"Bundler does not have write access to create a temp directory " \
"within #{Dir.tmpdir}. Bundler must have write access to your " \
"systems temp directory to function properly. "
rescue Zlib::GzipFile::Error
raise Bundler::HTTPError
end
Expand Down
10 changes: 0 additions & 10 deletions bundler/spec/bundler/compact_index_client/updater_spec.rb
Expand Up @@ -36,16 +36,6 @@
end
end

context "when bundler doesn't have permissions on Dir.tmpdir" do
it "Errno::EACCES is raised" do
allow(Bundler::Dir).to receive(:mktmpdir) { raise Errno::EACCES }

expect do
updater.update(local_path, remote_path)
end.to raise_error(Bundler::PermissionError)
end
end

context "when receiving non UTF-8 data and default internal encoding set to ASCII" do
let(:response) { double(:response, :body => "\x8B".b) }

Expand Down

0 comments on commit f7dbe54

Please sign in to comment.