Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:favogt:symbolictw
ruby3.3
7939.diff
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 7939.diff of Package ruby3.3
Index: ruby-3.3.5/lib/rubygems/installer.rb =================================================================== --- ruby-3.3.5.orig/lib/rubygems/installer.rb +++ ruby-3.3.5/lib/rubygems/installer.rb @@ -538,7 +538,7 @@ class Gem::Installer def generate_bin_script(filename, bindir) bin_script_path = File.join bindir, formatted_program_filename(filename) - Gem.open_file_with_flock("#{bin_script_path}.lock") do + Gem.open_file_with_flock("#{bin_script_path}.lock") do |lock| require "fileutils" FileUtils.rm_f bin_script_path # prior install may have been --no-wrappers @@ -546,6 +546,8 @@ class Gem::Installer file.write app_script_text(filename) file.chmod(options[:prog_mode] || 0o755) end + ensure + FileUtils.rm_f lock.path end verbose bin_script_path Index: ruby-3.3.5/test/rubygems/test_gem_installer.rb =================================================================== --- ruby-3.3.5.orig/test/rubygems/test_gem_installer.rb +++ ruby-3.3.5/test/rubygems/test_gem_installer.rb @@ -1083,6 +1083,8 @@ end end assert_match(/ran executable/, e.message) + + assert_path_not_exist(File.join(installer.bin_dir, "executable.lock")) end def test_conflicting_binstubs @@ -1131,6 +1133,8 @@ end # We expect the bin stub to activate the version that actually contains # the binstub. assert_match("I have an executable", e.message) + + assert_path_not_exist(File.join(installer.bin_dir, "executable.lock")) end def test_install_creates_binstub_that_understand_version @@ -1160,6 +1164,8 @@ end end assert_includes(e.message, "can't find gem a (= 3.0)") + + assert_path_not_exist(File.join(installer.bin_dir, "executable.lock")) end def test_install_creates_binstub_that_prefers_user_installed_gem_to_default @@ -1192,6 +1198,8 @@ end end assert_equal(e.message, "ran executable") + + assert_path_not_exist(File.join(installer.bin_dir, "executable.lock")) end def test_install_creates_binstub_that_dont_trust_encoding @@ -1222,6 +1230,35 @@ end end assert_match(/ran executable/, e.message) + + assert_path_not_exist(File.join(installer.bin_dir, "executable.lock")) + end + + def test_install_does_not_leave_lockfile_for_binstub + installer = util_setup_installer + + installer.wrappers = true + + File.class_eval do + alias_method :original_chmod, :chmod + define_method(:chmod) do |mode| + original_chmod(mode) + raise Gem::Ext::BuildError if path.end_with?("/executable") + end + end + + assert_raise(Gem::Ext::BuildError) do + installer.install + end + + assert_path_not_exist(File.join(installer.bin_dir, "executable.lock")) + # assert_path_not_exist(File.join(installer.bin_dir, "executable")) + ensure + File.class_eval do + remove_method :chmod + alias_method :chmod, :original_chmod + remove_method :original_chmod + end end def test_install_with_no_prior_files
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor