bootsnap 1.24.1 → 1.24.3

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: 86fd14b9f3a5920de24b3faf51c01e36ee19b20fc810ee6780c2ba8447871db9
4
- data.tar.gz: 4df2ffc0617e1957f264e7fb72002cec56ffb8bfe6f84534343c1b852c37e5e4
3
+ metadata.gz: 31d64e50bd32368c8dffe927b63fa6e62243b697a2606ca3e2330c4694ec816b
4
+ data.tar.gz: 5dfc374040409d1d20e893abc6a8c6052de02cf560c15e7678a5db2084bd722c
5
5
  SHA512:
6
- metadata.gz: 32879429b4f7473a5ed1ea6e32799a3d45d2203a46e867282d0e503396b40acce0a69faf2e83895271f80a369247fb4eeeae63b0022c25f805e5ed9fa073a581
7
- data.tar.gz: f354b078188dfb893c6690a80aa830498bce489e868c132b29317020d73b455528914ce0880f748b8c5f2da2845df61fd2d986b142c58a0d8082b42e62329392
6
+ metadata.gz: ff9e6b5b2c47d0337fa8d46c487fd6881bc567f5ae01a17f85aa3821df9b7f8416283764f8309de6207d94eb00e6cd6ee845a1307dd601659e4d26cd6abbc7ea
7
+ data.tar.gz: e34adc7c5162da87d94358a99a5990d0dfbc6497fb141e7407614e181328e1091bd708fac0aa96e6bce8731283a367db6a5aa6e8a2afe3b848b2d0f6b73e3ba4
data/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Unreleased
2
2
 
3
+ # 1.24.3
4
+
5
+ * Fix the `1.24.2` workaround to parse Ruby files with UTF-8 even when the `LANG` environment variable
6
+ is unset or set to `C`.
7
+
8
+ # 1.24.2
9
+
10
+ * Workaround two Ruby bugs in `RubyVM::InstructionSequence.compile_file`, that were causing
11
+ files to be loaded with the old Ruby parser instead of Prism, causing issues with some pattern matching syntax.
12
+ Ref: https://bugs.ruby-lang.org/issues/22023
13
+
3
14
  # 1.24.1
4
15
 
5
16
  * Fix encoding of Ruby source files loaded when `BOOTSNAP_READONLY` is set.
@@ -36,19 +36,47 @@ module Bootsnap
36
36
  true
37
37
  end
38
38
 
39
+ has_ruby_bug_22023 = if defined?(RubyVM::InstructionSequence) && RubyVM::InstructionSequence.respond_to?(:compile_file_prism)
40
+ begin
41
+ RubyVM::InstructionSequence.compile_file(File.expand_path("../ruby_bug_22023_canary.rb", __FILE__))
42
+ false
43
+ rescue SyntaxError
44
+ true
45
+ end
46
+ end
47
+
48
+ if has_ruby_bug_22023 && RUBY_DESCRIPTION.include?("+PRISM")
49
+ module PatchRubyBug22023
50
+ def compile_file(path, options = nil)
51
+ compile_file_prism(path, options)
52
+ end
53
+
54
+ has_ruby_bug_22023_bis = !RubyVM::InstructionSequence.compile_file_prism(
55
+ File.expand_path("../ruby_bug_22023_canary.rb", __FILE__),
56
+ {frozen_string_literal: true},
57
+ ).eval.frozen?
58
+
59
+ if has_ruby_bug_22023_bis
60
+ def compile_file_prism(path, options = nil)
61
+ compile_prism(::File.read(path, encoding: Encoding::UTF_8), path, path, nil, options)
62
+ end
63
+ end
64
+ end
65
+ RubyVM::InstructionSequence.singleton_class.prepend(PatchRubyBug22023)
66
+ end
67
+
39
68
  if has_ruby_bug_18250
40
69
  def input_to_storage(_, path)
41
70
  iseq = RubyVM::InstructionSequence.compile_file(path, @compile_options)
42
-
43
- begin
44
- iseq.to_binary
45
- rescue TypeError
46
- UNCOMPILABLE # ruby bug #18250
47
- end
71
+ iseq.to_binary
72
+ rescue TypeError, SyntaxError # Ruby [Bug #18250] & [Bug #22023]
73
+ UNCOMPILABLE
48
74
  end
49
75
  else
50
76
  def input_to_storage(_, path)
51
77
  RubyVM::InstructionSequence.compile_file(path, @compile_options).to_binary
78
+ rescue SyntaxError # Ruby [Bug #22023]
79
+ UNCOMPILABLE
52
80
  end
53
81
  end
54
82
 
@@ -0,0 +1,10 @@
1
+ # rubocop:disable Style/FrozenStringLiteralComment
2
+ def foo(bars)
3
+ case bars
4
+ in [one, "a" | "b" => two]
5
+ puts "#{one} - #{two}"
6
+ end
7
+ end
8
+
9
+ _ = "test"
10
+ # rubocop:enable Style/FrozenStringLiteralComment
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bootsnap
4
- VERSION = "1.24.1"
4
+ VERSION = "1.24.3"
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.24.1
4
+ version: 1.24.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Burke Libbey
@@ -44,6 +44,7 @@ files:
44
44
  - lib/bootsnap/cli/worker_pool.rb
45
45
  - lib/bootsnap/compile_cache.rb
46
46
  - lib/bootsnap/compile_cache/iseq.rb
47
+ - lib/bootsnap/compile_cache/ruby_bug_22023_canary.rb
47
48
  - lib/bootsnap/compile_cache/yaml.rb
48
49
  - lib/bootsnap/explicit_require.rb
49
50
  - lib/bootsnap/load_path_cache.rb