bootsnap 1.9.3 → 1.9.4
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 +4 -4
- data/CHANGELOG.md +9 -0
- data/lib/bootsnap/load_path_cache/cache.rb +1 -11
- data/lib/bootsnap/load_path_cache/loaded_features_index.rb +5 -0
- data/lib/bootsnap/load_path_cache/store.rb +15 -3
- data/lib/bootsnap/version.rb +1 -1
- data/lib/bootsnap.rb +10 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7602567343afc549df266a1b3def7e8c1e755b03a9ce486d17bba7051e97dfda
|
4
|
+
data.tar.gz: 607abfa5738cb016172bba2eb94af48b80b9e73dddea1090be77b7ca7d9f121d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7effd658adb07d075cfbc883f47382c23f774a872fcfa2daa0b137ff5f903057a1f825a90cd96cd5784a2e72fcb583ce05b4fcf98201a2a2cb6830c90109e096
|
7
|
+
data.tar.gz: ed2f42c2e5e91c373c8882fbe17abfab93c43e6ab39b83a7aa3031d6dba48088da9c3a271b52bbb7bc83ace117d677ec25e4865936972d939a00b08580f5e45e
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
# Unreleased
|
2
2
|
|
3
|
+
# 1.9.4
|
4
|
+
|
5
|
+
* Ignore absolute paths in the loaded feature index. (#385)
|
6
|
+
This fixes a compatibility issue with Zeitwerk when Zeitwerk is loaded before bootsnap. It also should
|
7
|
+
reduce the memory usage and improve load performance of Zeitwerk managed files.
|
8
|
+
|
9
|
+
* Automatically invalidate the load path cache whenever the Ruby version change. (#387)
|
10
|
+
This is to avoid issues in case the same installation path is re-used for subsequent ruby patch releases.
|
11
|
+
|
3
12
|
# 1.9.3
|
4
13
|
|
5
14
|
* Only disable the compile cache for source files impacted by [Ruby 3.0.3 [Bug 18250]](https://bugs.ruby-lang.org/issues/18250).
|
@@ -48,7 +48,7 @@ module Bootsnap
|
|
48
48
|
reinitialize if (@has_relative_paths && dir_changed?) || stale?
|
49
49
|
feature = feature.to_s.freeze
|
50
50
|
|
51
|
-
return feature if absolute_path?(feature)
|
51
|
+
return feature if Bootsnap.absolute_path?(feature)
|
52
52
|
|
53
53
|
if feature.start_with?('./', '../')
|
54
54
|
return try_extensions ? expand_path(feature) : File.expand_path(feature).freeze
|
@@ -98,16 +98,6 @@ module Bootsnap
|
|
98
98
|
raise(LoadPathCache::FallbackScan, '', []) if @development_mode
|
99
99
|
end
|
100
100
|
|
101
|
-
if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
|
102
|
-
def absolute_path?(path)
|
103
|
-
path[1] == ':'
|
104
|
-
end
|
105
|
-
else
|
106
|
-
def absolute_path?(path)
|
107
|
-
path.start_with?(SLASH)
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
101
|
def unshift_paths(sender, *paths)
|
112
102
|
return unless sender == @path_obj
|
113
103
|
@mutex.synchronize { unshift_paths_locked(*paths) }
|
@@ -83,6 +83,11 @@ module Bootsnap
|
|
83
83
|
# 2. Inspect $LOADED_FEATURES upon return from yield to find the matching
|
84
84
|
# entry.
|
85
85
|
def register(short, long = nil)
|
86
|
+
# Absolute paths are not a concern.
|
87
|
+
if Bootsnap.absolute_path?(short.to_s)
|
88
|
+
return yield
|
89
|
+
end
|
90
|
+
|
86
91
|
if long.nil?
|
87
92
|
len = $LOADED_FEATURES.size
|
88
93
|
ret = yield
|
@@ -7,6 +7,9 @@ Bootsnap::ExplicitRequire.from_rubylibdir('fileutils')
|
|
7
7
|
module Bootsnap
|
8
8
|
module LoadPathCache
|
9
9
|
class Store
|
10
|
+
VERSION_KEY = '__bootsnap_ruby_version__'
|
11
|
+
CURRENT_VERSION = "#{RUBY_REVISION}-#{RUBY_PLATFORM}".freeze
|
12
|
+
|
10
13
|
NestedTransactionError = Class.new(StandardError)
|
11
14
|
SetOutsideTransactionNotAllowed = Class.new(StandardError)
|
12
15
|
|
@@ -62,15 +65,20 @@ module Bootsnap
|
|
62
65
|
|
63
66
|
def load_data
|
64
67
|
@data = begin
|
65
|
-
File.open(@store_path, encoding: Encoding::BINARY) do |io|
|
68
|
+
data = File.open(@store_path, encoding: Encoding::BINARY) do |io|
|
66
69
|
MessagePack.load(io)
|
67
70
|
end
|
71
|
+
if data.is_a?(Hash) && data[VERSION_KEY] == CURRENT_VERSION
|
72
|
+
data
|
73
|
+
else
|
74
|
+
default_data
|
75
|
+
end
|
68
76
|
# handle malformed data due to upgrade incompatibility
|
69
77
|
rescue Errno::ENOENT, MessagePack::MalformedFormatError, MessagePack::UnknownExtTypeError, EOFError
|
70
|
-
|
78
|
+
default_data
|
71
79
|
rescue ArgumentError => error
|
72
80
|
if error.message =~ /negative array size/
|
73
|
-
|
81
|
+
default_data
|
74
82
|
else
|
75
83
|
raise
|
76
84
|
end
|
@@ -93,6 +101,10 @@ module Bootsnap
|
|
93
101
|
retry
|
94
102
|
rescue SystemCallError
|
95
103
|
end
|
104
|
+
|
105
|
+
def default_data
|
106
|
+
{ VERSION_KEY => CURRENT_VERSION }
|
107
|
+
end
|
96
108
|
end
|
97
109
|
end
|
98
110
|
end
|
data/lib/bootsnap/version.rb
CHANGED
data/lib/bootsnap.rb
CHANGED
@@ -123,4 +123,14 @@ module Bootsnap
|
|
123
123
|
end
|
124
124
|
end
|
125
125
|
end
|
126
|
+
|
127
|
+
if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
|
128
|
+
def self.absolute_path?(path)
|
129
|
+
path[1] == ':'
|
130
|
+
end
|
131
|
+
else
|
132
|
+
def self.absolute_path?(path)
|
133
|
+
path.start_with?('/')
|
134
|
+
end
|
135
|
+
end
|
126
136
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bootsnap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.9.
|
4
|
+
version: 1.9.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Burke Libbey
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|