bootsnap 1.20.0 → 1.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8e0a92c2964b6f614db5d8bf1636026c49796a74ae82b1cf78d2e3ec39337fa2
4
- data.tar.gz: 8f2e985c4af37b7056b0ddbee9fdd98b31839eb50ce2bf028d3089d92c6a4a88
3
+ metadata.gz: adb5e1d46d7560b403e6ef7051f9ad2ef21feca194c41f0af77f2e73d6e06508
4
+ data.tar.gz: cebcb8c52f1da65f13c531d05f5150fbe2b54d3fa51e0122b2cf4f2998cb63b9
5
5
  SHA512:
6
- metadata.gz: e539a95b7f098a337b97a91cd9c29849b2734fac66716cb46b29bcb8e67c7fddd6b0ca07f3a0a6d9ecf6dca2d28b99f0ee5ae9743193f1b7f3ef0994117391d8
7
- data.tar.gz: 56b9d42182d85530439defae95000e4aceec364e6ba4a1e69815127a3a5c782b330cef032c5d6f0ceb9b19ca2da30c6bc192eac33c878664e878772134137545
6
+ metadata.gz: 6ff78c410b363a8e2fbc9e370b684865a3aaa45e6de961d9d8dd6b1207fa2002a4d0115751ad5b259e21d69d215a4859587da79386e3b6d0cdde7e54205620d2
7
+ data.tar.gz: bac1b52dfad5b0e0e1e03e6feeeb2c9d3555608410b7a73fc005e044bf31641aa8bdd72bf4f595eee69b7c58e4701579c5e6961a4937246567ef097bb9956aaf
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Unreleased
2
2
 
3
+ # 1.21.0
4
+
5
+ * Fix the `require` decorator to handle `Bootsnap.unload_cache!` being called.
6
+ * Minor optimization: Eagerly clear cache buffers to appease the GC.
7
+
8
+ # 1.20.1
9
+
10
+ * Handle broken symlinks in load path scanning code.
11
+ Should fix `Errno::ENOENT fstatat` issues some users have encountered after upgrading to 1.20.0.
12
+
3
13
  # 1.20.0
4
14
 
5
15
  * Optimized load path scanning with a C extension. Should be about 2x faster on supported platforms.
@@ -191,6 +191,10 @@ bs_rb_scan_dir(VALUE self, VALUE abspath)
191
191
  }
192
192
 
193
193
  if (fstatat(dfd, entry->d_name, &st, 0)) {
194
+ if (errno == ENOENT) {
195
+ // Broken symlinK
196
+ continue;
197
+ }
194
198
  rb_sys_fail("fstatat");
195
199
  return Qundef;
196
200
  }
@@ -50,7 +50,9 @@ module Bootsnap
50
50
  end
51
51
 
52
52
  def self.storage_to_output(binary, _args)
53
- RubyVM::InstructionSequence.load_from_binary(binary)
53
+ iseq = RubyVM::InstructionSequence.load_from_binary(binary)
54
+ binary.clear
55
+ iseq
54
56
  rescue RuntimeError => error
55
57
  if error.message == "broken binary format"
56
58
  $stderr.puts("[Bootsnap::CompileCache] warning: rejecting broken binary")
@@ -170,7 +170,9 @@ module Bootsnap
170
170
  unpacker = CompileCache::YAML.msgpack_factory.unpacker(kwargs)
171
171
  unpacker.feed(data)
172
172
  _safe_loaded = unpacker.unpack
173
- unpacker.unpack
173
+ result = unpacker.unpack
174
+ data.clear
175
+ result
174
176
  end
175
177
 
176
178
  def input_to_output(data, kwargs)
@@ -15,8 +15,11 @@ module Kernel
15
15
  if Bootsnap::LoadPathCache::FALLBACK_SCAN.equal?(resolved)
16
16
  if (cursor = Bootsnap::LoadPathCache.loaded_features_index.cursor(string_path))
17
17
  ret = require_without_bootsnap(path)
18
- resolved = Bootsnap::LoadPathCache.loaded_features_index.identify(string_path, cursor)
19
- Bootsnap::LoadPathCache.loaded_features_index.register(string_path, resolved)
18
+
19
+ # The file we required may have unloaded the cache
20
+ resolved = Bootsnap::LoadPathCache.loaded_features_index&.identify(string_path, cursor)
21
+ Bootsnap::LoadPathCache.loaded_features_index&.register(string_path, resolved)
22
+
20
23
  return ret
21
24
  else
22
25
  return require_without_bootsnap(path)
@@ -28,7 +31,9 @@ module Kernel
28
31
  else
29
32
  # Note that require registers to $LOADED_FEATURES while load does not.
30
33
  ret = require_without_bootsnap(resolved)
31
- Bootsnap::LoadPathCache.loaded_features_index.register(string_path, resolved)
34
+
35
+ # The file we required may have unloaded the cache
36
+ Bootsnap::LoadPathCache.loaded_features_index&.register(string_path, resolved)
32
37
  return ret
33
38
  end
34
39
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bootsnap
4
- VERSION = "1.20.0"
4
+ VERSION = "1.21.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bootsnap
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.20.0
4
+ version: 1.21.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Burke Libbey