From 4d1a4100a89341250d988258a01a3c69d40db284 Mon Sep 17 00:00:00 2001 From: Ken Collins Date: Mon, 26 Apr 2021 19:05:24 -0400 Subject: [PATCH 1/2] Ignore Read-Only Filesystems --- lib/bootsnap/load_path_cache/store.rb | 1 + test/load_path_cache/store_test.rb | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/lib/bootsnap/load_path_cache/store.rb b/lib/bootsnap/load_path_cache/store.rb index 4e0c2a91..835daee5 100644 --- a/lib/bootsnap/load_path_cache/store.rb +++ b/lib/bootsnap/load_path_cache/store.rb @@ -91,6 +91,7 @@ def dump_data FileUtils.mv(tmp, @store_path) rescue Errno::EEXIST retry + rescue Errno::EROFS end end end diff --git a/test/load_path_cache/store_test.rb b/test/load_path_cache/store_test.rb index b70792d0..74e23544 100644 --- a/test/load_path_cache/store_test.rb +++ b/test/load_path_cache/store_test.rb @@ -74,6 +74,12 @@ def test_retry_on_collision store.transaction { store.set('a', 1) } end + + def test_ignore_read_only_filesystem + MessagePack.expects(:dump).raises(Errno::EROFS.new("Read-only file system @ rb_sysopen")) + store.transaction { store.set('a', 1) } + refute(File.exist?(@path)) + end end end end From 4ccccfc9490deebceabda1c1f56d6c24b6eb9ec2 Mon Sep 17 00:00:00 2001 From: Ken Collins Date: Tue, 27 Apr 2021 08:02:50 -0400 Subject: [PATCH 2/2] Use SystemCallError vs Errno::EROFS --- lib/bootsnap/load_path_cache/store.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bootsnap/load_path_cache/store.rb b/lib/bootsnap/load_path_cache/store.rb index 835daee5..5f5e9fa2 100644 --- a/lib/bootsnap/load_path_cache/store.rb +++ b/lib/bootsnap/load_path_cache/store.rb @@ -91,7 +91,7 @@ def dump_data FileUtils.mv(tmp, @store_path) rescue Errno::EEXIST retry - rescue Errno::EROFS + rescue SystemCallError end end end