bootsnap 1.7.3 → 1.7.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +20 -0
- data/ext/bootsnap/bootsnap.c +6 -5
- data/lib/bootsnap.rb +3 -1
- data/lib/bootsnap/cli/worker_pool.rb +5 -1
- data/lib/bootsnap/load_path_cache/cache.rb +1 -1
- data/lib/bootsnap/load_path_cache/change_observer.rb +2 -0
- data/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb +2 -1
- data/lib/bootsnap/load_path_cache/loaded_features_index.rb +2 -2
- data/lib/bootsnap/load_path_cache/store.rb +1 -0
- data/lib/bootsnap/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a8dcb9776e0582e39a71a07fbb73860eb2651de20a010ac6cbb454b48c838011
|
4
|
+
data.tar.gz: ca48bd960ee5748c5dd558b63cfcddf9e49234d8310a37d6e85fe87bab8f76a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9c3ff24e459657af721f25543e60437ea39fb2eb0d8af94f1d78140db12728430e084e2b7ecc4ff169b1b23f775bedb959fa887066dc971596613f08efc3f46
|
7
|
+
data.tar.gz: b432abcbecc3c1017047e43826fc1da3116dc9efd0c383b7f65ccbfea9230d0f345f5aa338879fbfebc87f795106ff922d1c4badb45a3fcd954ed21665fe101c
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,25 @@
|
|
1
1
|
# Unreleased
|
2
2
|
|
3
|
+
# 1.7.7
|
4
|
+
|
5
|
+
* Fix `require_relative` in evaled code on latest ruby 3.1.0-dev. (#366)
|
6
|
+
|
7
|
+
# 1.7.6
|
8
|
+
|
9
|
+
* Fix reliance on `set` to be required.
|
10
|
+
* Fix `Encoding::UndefinedConversionError` error for Rails applications when precompiling cache. (#364)
|
11
|
+
|
12
|
+
# 1.7.5
|
13
|
+
|
14
|
+
* Handle a regression of Ruby 2.7.3 causing Bootsnap to call the deprecated `untaint` method. (#360)
|
15
|
+
* Gracefully handle read-only file system as well as other errors preventing to persist the load path cache. (#358)
|
16
|
+
|
17
|
+
# 1.7.4
|
18
|
+
|
19
|
+
* Stop raising errors when encoutering various file system errors. The cache is now best effort,
|
20
|
+
if somehow it can't be saved, bootsnapp will gracefully fallback to the original operation (e.g. `Kernel.require`).
|
21
|
+
(#353, #177, #262)
|
22
|
+
|
3
23
|
# 1.7.3
|
4
24
|
|
5
25
|
* Disable YAML precompilation when encountering YAML tags. (#351)
|
data/ext/bootsnap/bootsnap.c
CHANGED
@@ -464,8 +464,7 @@ open_cache_file(const char * path, struct bs_cache_key * key, const char ** errn
|
|
464
464
|
fd = open(path, O_RDONLY);
|
465
465
|
if (fd < 0) {
|
466
466
|
*errno_provenance = "bs_fetch:open_cache_file:open";
|
467
|
-
|
468
|
-
return ERROR_WITH_ERRNO;
|
467
|
+
return CACHE_MISS;
|
469
468
|
}
|
470
469
|
#ifdef _WIN32
|
471
470
|
setmode(fd, O_BINARY);
|
@@ -763,9 +762,11 @@ bs_fetch(char * path, VALUE path_v, char * cache_path, VALUE handler, VALUE args
|
|
763
762
|
/* If storage_data isn't a string, we can't cache it */
|
764
763
|
if (!RB_TYPE_P(storage_data, T_STRING)) goto invalid_type_storage_data;
|
765
764
|
|
766
|
-
/*
|
767
|
-
|
768
|
-
|
765
|
+
/* Attempt to write the cache key and storage_data to the cache directory.
|
766
|
+
* We do however ignore any failures to persist the cache, as it's better
|
767
|
+
* to move along, than to interrupt the process.
|
768
|
+
*/
|
769
|
+
atomic_write_cache_file(cache_path, ¤t_key, storage_data, &errno_provenance);
|
769
770
|
|
770
771
|
/* Having written the cache, now convert storage_data to output_data */
|
771
772
|
exception_tag = bs_storage_to_output(handler, args, storage_data, &output_data);
|
data/lib/bootsnap.rb
CHANGED
@@ -27,7 +27,9 @@ module Bootsnap
|
|
27
27
|
|
28
28
|
def self.instrumentation=(callback)
|
29
29
|
@instrumentation = callback
|
30
|
-
|
30
|
+
if respond_to?(:instrumentation_enabled=, true)
|
31
|
+
self.instrumentation_enabled = !!callback
|
32
|
+
end
|
31
33
|
end
|
32
34
|
|
33
35
|
def self._instrument(event, path)
|
@@ -37,7 +37,11 @@ module Bootsnap
|
|
37
37
|
|
38
38
|
def initialize(jobs)
|
39
39
|
@jobs = jobs
|
40
|
-
@pipe_out, @to_io = IO.pipe
|
40
|
+
@pipe_out, @to_io = IO.pipe(binmode: true)
|
41
|
+
# Set the writer encoding to binary since IO.pipe only sets it for the reader.
|
42
|
+
# https://github.com/rails/rails/issues/16514#issuecomment-52313290
|
43
|
+
@to_io.set_encoding(Encoding::BINARY)
|
44
|
+
|
41
45
|
@pid = nil
|
42
46
|
end
|
43
47
|
|
@@ -196,7 +196,7 @@ module Bootsnap
|
|
196
196
|
|
197
197
|
s = rand.to_s.force_encoding(Encoding::US_ASCII).freeze
|
198
198
|
if s.respond_to?(:-@)
|
199
|
-
if (-s).equal?(s) && (-s.dup).equal?(s)
|
199
|
+
if (-s).equal?(s) && (-s.dup).equal?(s) || RUBY_VERSION >= '2.7'
|
200
200
|
def try_index(f)
|
201
201
|
if (p = @index[f])
|
202
202
|
-(File.join(p, f).freeze)
|
@@ -15,11 +15,13 @@ module Bootsnap
|
|
15
15
|
@lpc_observer.push_paths(self, *entries.map(&:to_s))
|
16
16
|
super
|
17
17
|
end
|
18
|
+
alias_method :append, :push
|
18
19
|
|
19
20
|
def unshift(*entries)
|
20
21
|
@lpc_observer.unshift_paths(self, *entries.map(&:to_s))
|
21
22
|
super
|
22
23
|
end
|
24
|
+
alias_method :prepend, :unshift
|
23
25
|
|
24
26
|
def concat(entries)
|
25
27
|
@lpc_observer.push_paths(self, *entries.map(&:to_s))
|
@@ -47,8 +47,9 @@ module Kernel
|
|
47
47
|
|
48
48
|
alias_method(:require_relative_without_bootsnap, :require_relative)
|
49
49
|
def require_relative(path)
|
50
|
+
location = caller_locations(1..1).first
|
50
51
|
realpath = Bootsnap::LoadPathCache.realpath_cache.call(
|
51
|
-
|
52
|
+
location.absolute_path || location.path, path
|
52
53
|
)
|
53
54
|
require(realpath)
|
54
55
|
end
|
@@ -58,9 +58,9 @@ module Bootsnap
|
|
58
58
|
end
|
59
59
|
|
60
60
|
def purge_multi(features)
|
61
|
-
rejected_hashes = features.
|
61
|
+
rejected_hashes = features.each_with_object({}) { |f, h| h[f.hash] = true }
|
62
62
|
@mutex.synchronize do
|
63
|
-
@lfi.reject! { |_, hash| rejected_hashes.
|
63
|
+
@lfi.reject! { |_, hash| rejected_hashes.key?(hash) }
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
data/lib/bootsnap/version.rb
CHANGED
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.7.
|
4
|
+
version: 1.7.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Burke Libbey
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-08-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -42,14 +42,14 @@ dependencies:
|
|
42
42
|
name: rake-compiler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
@@ -153,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
153
153
|
- !ruby/object:Gem::Version
|
154
154
|
version: '0'
|
155
155
|
requirements: []
|
156
|
-
rubygems_version: 3.
|
156
|
+
rubygems_version: 3.2.20
|
157
157
|
signing_key:
|
158
158
|
specification_version: 4
|
159
159
|
summary: Boot large ruby/rails apps faster
|