summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThe Bundler Bot <bot@bundler.io>2018-06-15 04:21:45 +0000
committerColby Swandale <hello@colby.fyi>2018-07-10 23:02:45 +1000
commit8da65ba7cabc881c2a4f571ebcd18a5ce1a1a238 (patch)
tree150970dac5dbc9392228e08822d612fd617b9a96
parent7a95824cf791dd927d72f53a1f32a25e64f1063c (diff)
downloadbundler-8da65ba7cabc881c2a4f571ebcd18a5ce1a1a238.tar.gz
Auto merge of #6573 - bundler:colby/process-lock-enotsup, r=segiddins
handle Errno::ENOTSUP in the Bundler process lock ### What was the end-user problem that led to this PR? Bundler is trying to perform an operation on an NFS that is raising an exception (Errno::ENOTSUP) ### What was your diagnosis of the problem? See #6566 ### What is your fix for the problem, implemented in this PR? Catch the exception and allow Bundler to continue ### Why did you choose this fix out of the possible options? This conforms with the existing pattern in regards to handling these types of errors in the Bundler process lock logic. (cherry picked from commit e87e499f9461ee5e00ef2f3cad600dac82152934)
-rw-r--r--lib/bundler/process_lock.rb2
-rw-r--r--spec/install/process_lock_spec.rb11
2 files changed, 12 insertions, 1 deletions
diff --git a/lib/bundler/process_lock.rb b/lib/bundler/process_lock.rb
index 4bd6931577..cba4fcdba5 100644
--- a/lib/bundler/process_lock.rb
+++ b/lib/bundler/process_lock.rb
@@ -12,7 +12,7 @@ module Bundler
yield
f.flock(File::LOCK_UN)
end
- rescue Errno::EACCES, Errno::ENOLCK
+ rescue Errno::EACCES, Errno::ENOLCK, *[SharedHelpers.const_get_safely(:ENOTSUP, Errno)].compact
# 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.
diff --git a/spec/install/process_lock_spec.rb b/spec/install/process_lock_spec.rb
index 02217f493b..be8fd04fdd 100644
--- a/spec/install/process_lock_spec.rb
+++ b/spec/install/process_lock_spec.rb
@@ -20,5 +20,16 @@ RSpec.describe "process lock spec" do
thread.join
expect(the_bundle).to include_gems "rack 1.0"
end
+
+ context "when creating a lock raises Errno::ENOTSUP", :ruby => ">= 1.9" do
+ before { allow(File).to receive(:open).and_raise(Errno::ENOTSUP) }
+
+ 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