From c89bcbd58eb48e39ab7e7c47a2226e876c885b07 Mon Sep 17 00:00:00 2001 From: Vasily Fedoseyev Date: Fri, 27 Dec 2024 22:22:37 +0300 Subject: [rubygems/rubygems] Do not fail on start when cannot find writable user directory on ruby 3.4 https://github.com/rubygems/rubygems/commit/027cdc750a --- lib/bundler/plugin/index.rb | 4 ++++ spec/bundler/bundler/plugin/index_spec.rb | 8 -------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/bundler/plugin/index.rb b/lib/bundler/plugin/index.rb index c2ab8f90da..0b1234bbf3 100644 --- a/lib/bundler/plugin/index.rb +++ b/lib/bundler/plugin/index.rb @@ -34,6 +34,10 @@ module Bundler rescue GenericSystemCallError # no need to fail when on a read-only FS, for example nil + rescue ArgumentError => e + # ruby 3.4 checks writability in Dir.tmpdir + raise unless e.message&.include?("could not find a temporary directory") + nil end load_index(local_index_file) if SharedHelpers.in_bundle? end diff --git a/spec/bundler/bundler/plugin/index_spec.rb b/spec/bundler/bundler/plugin/index_spec.rb index e1f10a0db7..565fc9b088 100644 --- a/spec/bundler/bundler/plugin/index_spec.rb +++ b/spec/bundler/bundler/plugin/index_spec.rb @@ -193,12 +193,4 @@ RSpec.describe Bundler::Plugin::Index do include_examples "it cleans up" end end - - describe "readonly disk without home" do - it "ignores being unable to create temp home dir" do - expect_any_instance_of(Bundler::Plugin::Index).to receive(:global_index_file). - and_raise(Bundler::GenericSystemCallError.new("foo", "bar")) - Bundler::Plugin::Index.new - end - end end -- cgit v1.2.3