bootsnap 1.4.2.rc2-java → 1.4.3-java

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
  SHA1:
3
- metadata.gz: f8d5ad54753db56bfcd3c4ff029c74314d8a2a42
4
- data.tar.gz: c68223fa41e4ef4e2a972251d7e9dc712efa279f
3
+ metadata.gz: 1da2c9355b194f496d516037840a1853128f3e3b
4
+ data.tar.gz: 310e93db85d4dc71647ab155e5a25b0af265533f
5
5
  SHA512:
6
- metadata.gz: 6d2c95079cbcd95f6143afd04d889b9677fe85e3a0661429e3f5808059bd10715ce036a4a7660a08133122897aa17d289c9f35cf258993594b8f9026ea2193d4
7
- data.tar.gz: b7e23c0335ea3f580e7bd60d3de96823189b478fe24b75146320a012c1218f3db037b510647dda8e7885f0e702eabefaf6f5386eec406763aa35cb3fb4869ac4
6
+ metadata.gz: 37ae91b0e6b0cc9fa79f6e3745888dde06b6d3d69f06fa9a6c41b551d9b5a914438475c2999da8e9812fdb665d580467d3659e86e5c3fe9570795cb2095df418
7
+ data.tar.gz: f7803683394dda64d2c68c9c3fc0d8868183f35fe0b56d8867c02bdbb597e86d843bd5c35de04730dc3f866afc77b9b5de376783582ac2515625bff08429cd3b
@@ -1,3 +1,7 @@
1
+ # 1.4.3
2
+
3
+ * Fix some cache permissions and umask issues after switch to mkstemp
4
+
1
5
  # 1.4.2
2
6
 
3
7
  * Fix bug when removing features loaded by relative path from `$LOADED_FEATURES`
data/README.md CHANGED
@@ -33,6 +33,10 @@ Note that bootsnap writes to `tmp/cache`, and that directory *must* be writable.
33
33
  boot if it is not. If this is unacceptable (e.g. you are running in a read-only container and
34
34
  unwilling to mount in a writable tmpdir), you should remove this line or wrap it in a conditional.
35
35
 
36
+ **Note also that bootsnap will never clean up its own cache: this is left up to you. Depending on your
37
+ deployment strategy, you may need to periodically purge `tmp/cache/bootsnap*`. If you notice deploys
38
+ getting progressively slower, this is almost certainly the cause.**
39
+
36
40
  It's technically possible to simply specify `gem 'bootsnap', require: 'bootsnap/setup'`, but it's
37
41
  important to load Bootsnap as early as possible to get maximum performance improvement.
38
42
 
@@ -74,6 +74,8 @@ static uint32_t current_ruby_platform;
74
74
  static uint32_t current_ruby_revision;
75
75
  /* Invalidates cache when RubyVM::InstructionSequence.compile_option changes */
76
76
  static uint32_t current_compile_option_crc32 = 0;
77
+ /* Current umask */
78
+ static mode_t current_umask;
77
79
 
78
80
  /* Bootsnap::CompileCache::{Native, Uncompilable} */
79
81
  static VALUE rb_mBootsnap;
@@ -142,6 +144,9 @@ Init_bootsnap(void)
142
144
  rb_define_module_function(rb_mBootsnap_CompileCache_Native, "coverage_running?", bs_rb_coverage_running, 0);
143
145
  rb_define_module_function(rb_mBootsnap_CompileCache_Native, "fetch", bs_rb_fetch, 3);
144
146
  rb_define_module_function(rb_mBootsnap_CompileCache_Native, "compile_option_crc32=", bs_compile_option_crc32_set, 1);
147
+
148
+ current_umask = umask(0777);
149
+ umask(current_umask);
145
150
  }
146
151
 
147
152
  /*
@@ -482,7 +487,6 @@ atomic_write_cache_file(char * path, struct bs_cache_key * key, VALUE data, char
482
487
  *errno_provenance = (char *)"bs_fetch:atomic_write_cache_file:mkpath";
483
488
  return -1;
484
489
  }
485
- close(fd);
486
490
  fd = open(tmp_path, O_WRONLY | O_CREAT, 0664);
487
491
  if (fd < 0) {
488
492
  *errno_provenance = (char *)"bs_fetch:atomic_write_cache_file:open";
@@ -517,6 +521,11 @@ atomic_write_cache_file(char * path, struct bs_cache_key * key, VALUE data, char
517
521
  ret = rename(tmp_path, path);
518
522
  if (ret < 0) {
519
523
  *errno_provenance = (char *)"bs_fetch:atomic_write_cache_file:rename";
524
+ return -1;
525
+ }
526
+ ret = chmod(path, 0664 & ~current_umask);
527
+ if (ret < 0) {
528
+ *errno_provenance = (char *)"bs_fetch:atomic_write_cache_file:chmod";
520
529
  }
521
530
  return ret;
522
531
  }
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bootsnap
2
4
  module LoadPathCache
3
5
  ReturnFalse = Class.new(StandardError)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative('../explicit_require')
2
4
 
3
5
  module Bootsnap
@@ -4,4 +4,14 @@ class << $LOADED_FEATURES
4
4
  Bootsnap::LoadPathCache.loaded_features_index.purge(key)
5
5
  delete_without_bootsnap(key)
6
6
  end
7
+
8
+ alias_method(:reject_without_bootsnap!, :reject!)
9
+ def reject!(&block)
10
+ backup = dup
11
+
12
+ # FIXME: if no block is passed we'd need to return a decorated iterator
13
+ reject_without_bootsnap!(&block)
14
+
15
+ Bootsnap::LoadPathCache.loaded_features_index.purge_multi(backup - self)
16
+ end
7
17
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Bootsnap
2
4
  module LoadPathCache
3
5
  # LoadedFeaturesIndex partially mirrors an internal structure in ruby that
@@ -55,6 +57,13 @@ module Bootsnap
55
57
  end
56
58
  end
57
59
 
60
+ def purge_multi(features)
61
+ rejected_hashes = features.map(&:hash).to_set
62
+ @mutex.synchronize do
63
+ @lfi.reject! { |_, hash| rejected_hashes.include?(hash) }
64
+ end
65
+ end
66
+
58
67
  def key?(feature)
59
68
  @mutex.synchronize { @lfi.key?(feature) }
60
69
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative('../explicit_require')
2
4
 
3
5
  module Bootsnap
@@ -11,7 +13,7 @@ module Bootsnap
11
13
  BUNDLE_PATH = if Bootsnap.bundler?
12
14
  (Bundler.bundle_path.cleanpath.to_s << LoadPathCache::SLASH).freeze
13
15
  else
14
- ''.freeze
16
+ ''
15
17
  end
16
18
 
17
19
  def self.call(path)
@@ -1,3 +1,3 @@
1
1
  module Bootsnap
2
- VERSION = "1.4.2.rc2"
2
+ VERSION = "1.4.3"
3
3
  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.4.2.rc2
4
+ version: 1.4.3
5
5
  platform: java
6
6
  authors:
7
7
  - Burke Libbey
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-20 00:00:00.000000000 Z
11
+ date: 2019-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -162,9 +162,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
162
162
  version: 2.0.0
163
163
  required_rubygems_version: !ruby/object:Gem::Requirement
164
164
  requirements:
165
- - - ">"
165
+ - - ">="
166
166
  - !ruby/object:Gem::Version
167
- version: 1.3.1
167
+ version: '0'
168
168
  requirements: []
169
169
  rubyforge_project:
170
170
  rubygems_version: 2.4.8