ruby-changes:70050
From: David <ko1@a...>
Date: Sat, 4 Dec 2021 05:18:29 +0900 (JST)
Subject: [ruby-changes:70050] c38c1d82b1 (master): [rubygems/rubygems] Let original EACCES error be raised
https://git.ruby-lang.org/ruby.git/commit/?id=c38c1d82b1 From c38c1d82b14237cd9d4268b88fef28e9379280f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <deivid.rodriguez@r...> Date: Mon, 29 Nov 2021 13:43:09 +0100 Subject: [rubygems/rubygems] Let original EACCES error be raised 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. https://github.com/rubygems/rubygems/commit/f7dbe54404 --- lib/bundler/compact_index_client/updater.rb | 5 ----- spec/bundler/bundler/compact_index_client/updater_spec.rb | 10 ---------- 2 files changed, 15 deletions(-) diff --git a/lib/bundler/compact_index_client/updater.rb b/lib/bundler/compact_index_client/updater.rb index 06486f98cb7..d9b9cec0d45 100644 --- a/lib/bundler/compact_index_client/updater.rb +++ b/lib/bundler/compact_index_client/updater.rb @@ -76,11 +76,6 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/compact_index_client/updater.rb#L76 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 diff --git a/spec/bundler/bundler/compact_index_client/updater_spec.rb b/spec/bundler/bundler/compact_index_client/updater_spec.rb index 4acd7dbc634..fe417e39206 100644 --- a/spec/bundler/bundler/compact_index_client/updater_spec.rb +++ b/spec/bundler/bundler/compact_index_client/updater_spec.rb @@ -36,16 +36,6 @@ RSpec.describe Bundler::CompactIndexClient::Updater do https://github.com/ruby/ruby/blob/trunk/spec/bundler/bundler/compact_index_client/updater_spec.rb#L36 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) } -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/