[rubygems/rubygems] Ignore `Errno::EPERM` errors when creating `bundler.lock`

This kind of error can happen when setting `GEM_HOME` to a path
under MacOS System Integrity Protection.

We ignore the error. Any permission issues should be better handled
further down the line.

https://github.com/rubygems/rubygems/commit/174cb66863
This commit is contained in:
David Rodríguez 2022-05-29 13:51:13 +02:00 коммит произвёл git
Родитель 931b013b9f
Коммит 373dabe00a
2 изменённых файлов: 12 добавлений и 1 удалений

Просмотреть файл

@ -12,7 +12,7 @@ module Bundler
yield
f.flock(File::LOCK_UN)
end
rescue Errno::EACCES, Errno::ENOLCK, Errno::ENOTSUP
rescue Errno::EACCES, Errno::ENOLCK, Errno::ENOTSUP, Errno::EPERM
# In the case the user does not have access to
# create the lock file or is using NFS where
# locks are not available we skip locking.

Просмотреть файл

@ -31,5 +31,16 @@ RSpec.describe "process lock spec" do
expect(processed).to eq true
end
end
context "when creating a lock raises Errno::EPERM" do
before { allow(File).to receive(:open).and_raise(Errno::EPERM) }
it "skips creating the lock file and yields" do
processed = false
Bundler::ProcessLock.lock(default_bundle_path) { processed = true }
expect(processed).to eq true
end
end
end
end