From b582e5a6e99c3e88076fc8eea794d0b3a23e8740 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Tue, 5 Mar 2024 15:02:04 +0900 Subject: [PATCH] [rubygems/rubygems] Clear generated files recursively On macOS, `dsymutil` utility splits debug info into .dSYM directory. Glob list of `.bundle/cache/extensions/**/*binary_c*` includes that directory but `FileUtils.rm` fails to unlink a directory. https://github.com/ruby/ruby/actions/runs/8149918901/job/22275331688#step:11:3000 ``` Operation not permitted @ apply2files - /Users/runner/work/ruby/ruby/src/tmp/2/home/.bundle/cache/extensions/arm64-darwin-22/ruby/3.4.0+0/3b02a1011c53518f911ab3a9e8c6c608/very_simple_binary-1.0/very_simple_binary_c.bundle.dSYM # ./lib/fileutils.rb:2332:in 'File.unlink' # ./lib/fileutils.rb:2332:in 'block in FileUtils::Entry_#remove_file' # ./lib/fileutils.rb:2337:in 'FileUtils::Entry_#platform_support' # ./lib/fileutils.rb:2331:in 'FileUtils::Entry_#remove_file' # ./lib/fileutils.rb:1475:in 'FileUtils.remove_file' # ./lib/fileutils.rb:1223:in 'block in FileUtils.rm' # ./lib/fileutils.rb:1222:in 'FileUtils.rm' # ./spec/bundler/install/global_cache_spec.rb:235:in 'block (3 levels) in ' ``` https://github.com/rubygems/rubygems/commit/375c127684 --- spec/bundler/install/global_cache_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/bundler/install/global_cache_spec.rb b/spec/bundler/install/global_cache_spec.rb index f482812f52..0da4de05b2 100644 --- a/spec/bundler/install/global_cache_spec.rb +++ b/spec/bundler/install/global_cache_spec.rb @@ -232,7 +232,7 @@ RSpec.describe "global gem caching" do R expect(out).to eq "VERY_SIMPLE_BINARY_IN_C\nVERY_SIMPLE_GIT_BINARY_IN_C" - FileUtils.rm Dir[home(".bundle", "cache", "extensions", "**", "*binary_c*")] + FileUtils.rm_rf Dir[home(".bundle", "cache", "extensions", "**", "*binary_c*")] gem_binary_cache.join("very_simple_binary_c.rb").open("w") {|f| f << "puts File.basename(__FILE__)" } git_binary_cache.join("very_simple_git_binary_c.rb").open("w") {|f| f << "puts File.basename(__FILE__)" }