Skip to content

Commit 3b66efd

Browse files
committed
Bundle RubyGems 4.0.2 and Bundler 4.0.2
1 parent 2117e61 commit 3b66efd

File tree

12 files changed

+99
-166
lines changed

12 files changed

+99
-166
lines changed

lib/bundler/shared_helpers.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,7 @@ def set_bundle_environment
105105
def filesystem_access(path, action = :write, &block)
106106
yield(path.dup)
107107
rescue Errno::EACCES => e
108-
path_basename = File.basename(path.to_s)
109-
raise unless e.message.include?(path_basename) || action == :create
108+
raise unless e.message.include?(path.to_s) || action == :create
110109

111110
raise PermissionError.new(path, action)
112111
rescue Errno::EAGAIN

lib/bundler/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# frozen_string_literal: false
22

33
module Bundler
4-
VERSION = "4.0.1".freeze
4+
VERSION = "4.0.2".freeze
55

66
def self.bundler_major_version
77
@bundler_major_version ||= gem_version.segments.first

lib/rubygems.rb

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,14 @@
99
require "rbconfig"
1010

1111
module Gem
12-
VERSION = "4.0.1"
12+
VERSION = "4.0.2"
1313
end
1414

1515
require_relative "rubygems/defaults"
1616
require_relative "rubygems/deprecate"
1717
require_relative "rubygems/errors"
1818
require_relative "rubygems/target_rbconfig"
1919
require_relative "rubygems/win_platform"
20-
require_relative "rubygems/util/atomic_file_writer"
2120

2221
##
2322
# RubyGems is the Ruby standard for publishing and managing third party
@@ -834,12 +833,14 @@ def self.read_binary(path)
834833
end
835834

836835
##
837-
# Atomically write a file in binary mode on all platforms.
836+
# Safely write a file in binary mode on all platforms.
838837

839838
def self.write_binary(path, data)
840-
Gem::AtomicFileWriter.open(path) do |file|
841-
file.write(data)
842-
end
839+
File.binwrite(path, data)
840+
rescue Errno::ENOSPC
841+
# If we ran out of space but the file exists, it's *guaranteed* to be corrupted.
842+
File.delete(path) if File.exist?(path)
843+
raise
843844
end
844845

845846
##

lib/rubygems/util/atomic_file_writer.rb

Lines changed: 0 additions & 67 deletions
This file was deleted.

spec/bundler/realworld/fixtures/tapioca/Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,4 @@ DEPENDENCIES
4646
tapioca
4747

4848
BUNDLED WITH
49-
4.0.1
49+
4.0.2

spec/bundler/realworld/fixtures/warbler/Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ DEPENDENCIES
3636
warbler!
3737

3838
BUNDLED WITH
39-
4.0.1
39+
4.0.2

test/rubygems/test_gem_installer.rb

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2385,31 +2385,25 @@ def test_leaves_no_empty_cached_spec_when_no_more_disk_space
23852385
installer = Gem::Installer.for_spec @spec
23862386
installer.gem_home = @gemhome
23872387

2388-
assert_raise(Errno::ENOSPC) do
2389-
Gem::AtomicFileWriter.open(@spec.spec_file) do
2388+
File.singleton_class.class_eval do
2389+
alias_method :original_binwrite, :binwrite
2390+
2391+
def binwrite(path, data)
23902392
raise Errno::ENOSPC
23912393
end
23922394
end
23932395

2394-
assert_path_not_exist @spec.spec_file
2395-
end
2396-
2397-
def test_write_default_spec
2398-
@spec = setup_base_spec
2399-
@spec.files = %w[a.rb b.rb c.rb]
2400-
2401-
installer = Gem::Installer.for_spec @spec
2402-
installer.gem_home = @gemhome
2403-
2404-
installer.write_default_spec
2405-
2406-
assert_path_exist installer.default_spec_file
2407-
2408-
loaded = Gem::Specification.load installer.default_spec_file
2396+
assert_raise Errno::ENOSPC do
2397+
installer.write_spec
2398+
end
24092399

2410-
assert_equal @spec.files, loaded.files
2411-
assert_equal @spec.name, loaded.name
2412-
assert_equal @spec.version, loaded.version
2400+
assert_path_not_exist @spec.spec_file
2401+
ensure
2402+
File.singleton_class.class_eval do
2403+
remove_method :binwrite
2404+
alias_method :binwrite, :original_binwrite
2405+
remove_method :original_binwrite
2406+
end
24132407
end
24142408

24152409
def test_dir

0 commit comments

Comments
 (0)