re2 2.19.0-x86_64-linux-musl → 2.21.0-x86_64-linux-musl

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: 26b7383ad7fe55ebf3c00e71db3313326dd01e3cca52e37bfd927555bf9f63df
4
- data.tar.gz: 76976e1aeefdf87d18d013ac9d789764993739244dcb8ae0825852c2683718c8
3
+ metadata.gz: 894ccd39ca4d27c1851d90ca1c1fab8d56f711ba825ff6c548fe1517bcb79d1d
4
+ data.tar.gz: 95bd05fffb687b4a2fc14b57e115660097fcfdf06d1401e5cdea1586e4d6f88d
5
5
  SHA512:
6
- metadata.gz: 95196fb32072869ee88d7bf15f7886853abfe9d07b051dc5d9b1a460c980c9fdb02a4e720db6d4720069c4042c6e404b05362f787265527f399860a608abe77e
7
- data.tar.gz: f76cbe8af1018f553a0c39e389c3d5ca7f38ba3cf559fca0530b06b0a56b8835c346d9ac56394f59bf3ce00ed44ca21c78acae8a681335ccf6e4276045c3ed32
6
+ metadata.gz: 48dbcc0ba3c50a85ccb9544917cca7e010dc8c7bb0f5f22b5158515cfe0fed99f20eb281f9cfe4400937dd96093a7463394908f53df09481052b54a917c6d4c6
7
+ data.tar.gz: 4802fccaffc465e3ec685c32557a2678868f2a324511b9a1b2f00166d0ee943b6488b39a5f56cf06d2ab76a36ae193203b9b47f7ba66aba82b1718957247001a
data/README.md CHANGED
@@ -6,8 +6,8 @@ Python".
6
6
 
7
7
  [![Build Status](https://github.com/mudge/re2/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/mudge/re2/actions)
8
8
 
9
- **Current version:** 2.19.0
10
- **Bundled RE2 version:** libre2.11 (2025-08-05)
9
+ **Current version:** 2.21.0
10
+ **Bundled RE2 version:** libre2.11 (2025-11-05)
11
11
 
12
12
  ```ruby
13
13
  RE2('h.*o').full_match?("hello") #=> true
@@ -260,21 +260,21 @@ RE2(non_latin1_pattern.encode("ISO-8859-1"), utf8: false).match(non_latin1_text.
260
260
 
261
261
  This gem requires the following to run:
262
262
 
263
- * [Ruby](https://www.ruby-lang.org/en/) 2.6 to 3.4
263
+ * [Ruby](https://www.ruby-lang.org/en/) 3.1 to 3.4
264
264
 
265
265
  It supports the following RE2 ABI versions:
266
266
 
267
- * libre2.0 (prior to release 2020-03-02) to libre2.11 (2023-07-01 to 2025-08-05)
267
+ * libre2.0 (prior to release 2020-03-02) to libre2.11 (2023-07-01 to 2025-11-05)
268
268
 
269
269
  ### Native gems
270
270
 
271
271
  Where possible, a pre-compiled native gem will be provided for the following platforms:
272
272
 
273
273
  * Linux
274
- * `aarch64-linux`, `arm-linux`, `x86-linux` and `x86_64-linux` (requires [glibc](https://www.gnu.org/software/libc/) 2.29+, RubyGems 3.3.22+ and Bundler 2.3.21+)
274
+ * `aarch64-linux`, `arm-linux`, and `x86_64-linux` (requires [glibc](https://www.gnu.org/software/libc/) 2.29+, RubyGems 3.3.22+ and Bundler 2.3.21+)
275
275
  * [musl](https://musl.libc.org/)-based systems such as [Alpine](https://alpinelinux.org) are supported with Bundler 2.5.6+
276
- * macOS `x86_64-darwin` and `arm64-darwin`
277
- * Windows `x64-mingw32` and `x64-mingw-ucrt`
276
+ * macOS 10.14+ `x86_64-darwin` and `arm64-darwin`
277
+ * Windows 2022+ `x64-mingw-ucrt`
278
278
 
279
279
  ### Verifying the gems
280
280
 
@@ -331,8 +331,8 @@ You will need a full compiler toolchain for compiling Ruby C extensions (see
331
331
  Toolchain"](https://nokogiri.org/tutorials/installing_nokogiri.html#appendix-a-the-compiler-toolchain))
332
332
  plus the toolchain required for compiling the vendored version of RE2 and its
333
333
  dependency [Abseil][] which includes [CMake](https://cmake.org), a compiler
334
- with C++14 support such as [clang](http://clang.llvm.org/) 3.4 or
335
- [gcc](https://gcc.gnu.org/) 5 and a recent version of
334
+ with C++17 support such as [clang](http://clang.llvm.org/) 5 or
335
+ [gcc](https://gcc.gnu.org/) 8 and a recent version of
336
336
  [pkg-config](https://www.freedesktop.org/wiki/Software/pkg-config/). On
337
337
  Windows, you'll also need pkgconf 2.1.0+ to avoid [`undefined reference`
338
338
  errors](https://github.com/pkgconf/pkgconf/issues/322) when attempting to
@@ -378,6 +378,8 @@ Alternatively, you can set the `RE2_USE_SYSTEM_LIBRARIES` environment variable i
378
378
  improvements in 2.4.0.
379
379
  * Thanks to [Manuel Jacob](https://github.com/manueljacob) for reporting a bug
380
380
  when passing strings with null bytes.
381
+ * Thanks to [Maciej Gajewski](https://github.com/konieczkow) for helping
382
+ confirm issues with GC compaction and mutable strings.
381
383
 
382
384
  ## Contact
383
385
 
data/Rakefile CHANGED
@@ -33,7 +33,7 @@ cross_platforms = %w[
33
33
  x86_64-linux-musl
34
34
  ].freeze
35
35
 
36
- RakeCompilerDock.set_ruby_cc_version("~> 2.6", "~> 3.0")
36
+ RakeCompilerDock.set_ruby_cc_version("~> 3.1")
37
37
 
38
38
  Gem::PackageTask.new(re2_gemspec).define
39
39
 
@@ -76,7 +76,7 @@ namespace :gem do
76
76
  sudo apt-get install -y cmake=3.22.2-0kitware1ubuntu20.04.1 cmake-data=3.22.2-0kitware1ubuntu20.04.1 &&
77
77
  rbenv shell 3.1.6 &&
78
78
  gem install bundler --no-document &&
79
- bundle &&
79
+ bundle install &&
80
80
  bundle exec rake native:#{platform} pkg/#{re2_gemspec.full_name}-#{Gem::Platform.new(platform)}.gem PATH="/usr/local/bin:$PATH"
81
81
  SCRIPT
82
82
  end
data/dependencies.yml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  libre2:
3
- version: '2025-08-05'
4
- sha256: b5708d8388110624c85f300e7e9b39c4ed5469891eb1127dd7f9d61272d04907
3
+ version: '2025-11-05'
4
+ sha256: 87f6029d2f6de8aa023654240a03ada90e876ce9a4676e258dd01ea4c26ffd67
5
5
  abseil:
6
- version: '20250127.1'
7
- sha256: b396401fd29e2e679cace77867481d388c807671dc2acc602a0259eeb79b7811
6
+ version: '20250814.1'
7
+ sha256: 1692f77d1739bacf3f94337188b78583cf09bab7e420d2dc6c5605a4f86785a1
data/ext/re2/extconf.rb CHANGED
@@ -103,6 +103,8 @@ module RE2
103
103
  def build_with_vendored_libraries
104
104
  message "Building re2 using packaged libraries.\n"
105
105
 
106
+ ENV["MACOSX_DEPLOYMENT_TARGET"] = "10.14"
107
+
106
108
  abseil_recipe, re2_recipe = load_recipes
107
109
 
108
110
  process_recipe(abseil_recipe) do |recipe|
@@ -129,10 +131,8 @@ module RE2
129
131
  end
130
132
 
131
133
  def build_extension
132
- # Enable optional warnings but disable deprecated register warning for Ruby 2.6 support
133
134
  $CFLAGS << " -Wall -Wextra -funroll-loops"
134
135
  $CXXFLAGS << " -Wall -Wextra -funroll-loops"
135
- $CPPFLAGS << " -Wno-register"
136
136
 
137
137
  # Pass -x c++ to force gcc to compile the test program
138
138
  # as C++ (as it will end in .c by default).
@@ -140,7 +140,6 @@ module RE2
140
140
 
141
141
  have_library("stdc++")
142
142
  have_header("stdint.h")
143
- have_func("rb_gc_mark_movable") # introduced in Ruby 2.7
144
143
 
145
144
  minimal_program = <<~SRC
146
145
  #include <re2/re2.h>
@@ -152,13 +151,9 @@ module RE2
152
151
  end
153
152
 
154
153
  if re2_requires_version_flag
155
- # Recent versions of re2 depend directly on abseil, which requires a
156
- # compiler with C++14 support (see
157
- # https://github.com/abseil/abseil-cpp/issues/1127 and
158
- # https://github.com/abseil/abseil-cpp/issues/1431). However, the
159
- # `std=c++14` flag doesn't appear to suffice; we need at least
160
- # `std=c++17`.
161
- abort "Cannot compile re2 with your compiler: recent versions require C++14 support." unless %w[c++20 c++17 c++11 c++0x].any? do |std|
154
+ # Recent versions of RE2 depend directly on Abseil, which requires a
155
+ # compiler with C++17 support.
156
+ abort "Cannot compile re2 with your compiler: recent versions require C++17 support." unless %w[c++20 c++17 c++11 c++0x].any? do |std|
162
157
  checking_for("re2 that compiles with #{std} standard") do
163
158
  if try_compile(minimal_program, compile_options + " -std=#{std}")
164
159
  compile_options << " -std=#{std}"
data/ext/re2/re2.cc CHANGED
@@ -125,27 +125,16 @@ static void parse_re2_options(RE2::Options* re2_options, const VALUE options) {
125
125
  }
126
126
  }
127
127
 
128
- /* For compatibility with Ruby < 2.7 */
129
- #ifdef HAVE_RB_GC_MARK_MOVABLE
130
- #define re2_compact_callback(x) (x),
131
- #else
132
- #define rb_gc_mark_movable(x) rb_gc_mark(x)
133
- #define re2_compact_callback(x)
134
- #endif
135
-
136
128
  static void re2_matchdata_mark(void *ptr) {
137
129
  re2_matchdata *m = reinterpret_cast<re2_matchdata *>(ptr);
138
130
  rb_gc_mark_movable(m->regexp);
139
- rb_gc_mark_movable(m->text);
131
+ rb_gc_mark(m->text);
140
132
  }
141
133
 
142
- #ifdef HAVE_RB_GC_MARK_MOVABLE
143
134
  static void re2_matchdata_compact(void *ptr) {
144
135
  re2_matchdata *m = reinterpret_cast<re2_matchdata *>(ptr);
145
136
  m->regexp = rb_gc_location(m->regexp);
146
- m->text = rb_gc_location(m->text);
147
137
  }
148
- #endif
149
138
 
150
139
  static void re2_matchdata_free(void *ptr) {
151
140
  re2_matchdata *m = reinterpret_cast<re2_matchdata *>(ptr);
@@ -171,7 +160,7 @@ static const rb_data_type_t re2_matchdata_data_type = {
171
160
  re2_matchdata_mark,
172
161
  re2_matchdata_free,
173
162
  re2_matchdata_memsize,
174
- re2_compact_callback(re2_matchdata_compact)
163
+ re2_matchdata_compact
175
164
  },
176
165
  0,
177
166
  0,
@@ -183,16 +172,13 @@ static const rb_data_type_t re2_matchdata_data_type = {
183
172
  static void re2_scanner_mark(void *ptr) {
184
173
  re2_scanner *s = reinterpret_cast<re2_scanner *>(ptr);
185
174
  rb_gc_mark_movable(s->regexp);
186
- rb_gc_mark_movable(s->text);
175
+ rb_gc_mark(s->text);
187
176
  }
188
177
 
189
- #ifdef HAVE_RB_GC_MARK_MOVABLE
190
178
  static void re2_scanner_compact(void *ptr) {
191
179
  re2_scanner *s = reinterpret_cast<re2_scanner *>(ptr);
192
180
  s->regexp = rb_gc_location(s->regexp);
193
- s->text = rb_gc_location(s->text);
194
181
  }
195
- #endif
196
182
 
197
183
  static void re2_scanner_free(void *ptr) {
198
184
  re2_scanner *s = reinterpret_cast<re2_scanner *>(ptr);
@@ -218,7 +204,7 @@ static const rb_data_type_t re2_scanner_data_type = {
218
204
  re2_scanner_mark,
219
205
  re2_scanner_free,
220
206
  re2_scanner_memsize,
221
- re2_compact_callback(re2_scanner_compact)
207
+ re2_scanner_compact
222
208
  },
223
209
  0,
224
210
  0,
@@ -290,10 +276,12 @@ static VALUE re2_matchdata_string(const VALUE self) {
290
276
  }
291
277
 
292
278
  /*
293
- * Returns the text supplied when incrementally matching with
279
+ * Returns a frozen copy of the text supplied when incrementally matching with
294
280
  * {RE2::Regexp#scan}.
295
281
  *
296
- * @return [String] the original string passed to {RE2::Regexp#scan}
282
+ * If the text was already a frozen string, returns the original.
283
+ *
284
+ * @return [String] a frozen string with the text passed to {RE2::Regexp#scan}
297
285
  * @example
298
286
  * c = RE2::Regexp.new('(\d+)').scan("foo")
299
287
  * c.string #=> "foo"
@@ -1626,10 +1614,13 @@ static VALUE re2_regexp_scan(const VALUE self, VALUE text) {
1626
1614
  VALUE scanner = rb_class_new_instance(0, 0, re2_cScanner);
1627
1615
  TypedData_Get_Struct(scanner, re2_scanner, &re2_scanner_data_type, c);
1628
1616
 
1629
- c->input = new(std::nothrow) re2::StringPiece(
1630
- RSTRING_PTR(text), RSTRING_LEN(text));
1631
1617
  RB_OBJ_WRITE(scanner, &c->regexp, self);
1618
+ if (!RTEST(rb_obj_frozen_p(text))) {
1619
+ text = rb_str_freeze(rb_str_dup(text));
1620
+ }
1632
1621
  RB_OBJ_WRITE(scanner, &c->text, text);
1622
+ c->input = new(std::nothrow) re2::StringPiece(
1623
+ RSTRING_PTR(text), RSTRING_LEN(text));
1633
1624
 
1634
1625
  if (p->pattern->ok()) {
1635
1626
  c->number_of_capturing_groups = p->pattern->NumberOfCapturingGroups();
data/ext/re2/recipes.rb CHANGED
@@ -9,7 +9,7 @@
9
9
  # Released under the BSD Licence, please see LICENSE.txt
10
10
 
11
11
  PACKAGE_ROOT_DIR = File.expand_path('../..', __dir__)
12
- REQUIRED_MINI_PORTILE_VERSION = '~> 2.8.7' # keep this version in sync with the one in the gemspec
12
+ REQUIRED_MINI_PORTILE_VERSION = '~> 2.8.9' # keep this version in sync with the one in the gemspec
13
13
 
14
14
  def load_recipes
15
15
  require 'yaml'
@@ -40,8 +40,8 @@ def build_recipe(name, version)
40
40
  MiniPortileCMake.new(name, version).tap do |recipe|
41
41
  recipe.target = File.join(PACKAGE_ROOT_DIR, 'ports')
42
42
  recipe.configure_options += [
43
- # abseil needs a C++14 compiler
44
- '-DCMAKE_CXX_STANDARD=14',
43
+ # abseil needs a C++17 compiler
44
+ '-DCMAKE_CXX_STANDARD=17',
45
45
  # needed for building the C extension shared library with -fPIC
46
46
  '-DCMAKE_POSITION_INDEPENDENT_CODE=ON',
47
47
  # ensures pkg-config and installed libraries will be in lib, not lib64
data/lib/3.1/re2.so CHANGED
Binary file
data/lib/3.2/re2.so CHANGED
Binary file
data/lib/3.3/re2.so CHANGED
Binary file
data/lib/3.4/re2.so CHANGED
Binary file
data/lib/re2/version.rb CHANGED
@@ -10,5 +10,5 @@
10
10
 
11
11
 
12
12
  module RE2
13
- VERSION = "2.19.0"
13
+ VERSION = "2.21.0"
14
14
  end
data/re2.gemspec CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
11
11
  s.homepage = "https://github.com/mudge/re2"
12
12
  s.extensions = ["ext/re2/extconf.rb"]
13
13
  s.license = "BSD-3-Clause"
14
- s.required_ruby_version = ">= 2.6.0"
14
+ s.required_ruby_version = ">= 3.1.0"
15
15
  s.files = [
16
16
  "dependencies.yml",
17
17
  "ext/re2/extconf.rb",
@@ -40,8 +40,8 @@ Gem::Specification.new do |s|
40
40
  "spec/re2/set_spec.rb",
41
41
  "spec/re2/scanner_spec.rb"
42
42
  ]
43
- s.add_development_dependency("rake-compiler", "~> 1.2.7")
43
+ s.add_development_dependency("rake-compiler", "~> 1.3.0")
44
44
  s.add_development_dependency("rake-compiler-dock", "~> 1.9.1")
45
45
  s.add_development_dependency("rspec", "~> 3.2")
46
- s.add_runtime_dependency("mini_portile2", "~> 2.8.7") # keep version in sync with extconf.rb
46
+ s.add_runtime_dependency("mini_portile2", "~> 2.8.9") # keep version in sync with extconf.rb
47
47
  end
@@ -133,6 +133,13 @@ RSpec.describe RE2::MatchData do
133
133
  expect(md["name"].encoding.name).to eq("ISO-8859-1")
134
134
  expect(md[:name].encoding.name).to eq("ISO-8859-1")
135
135
  end
136
+
137
+ it "supports GC compaction" do
138
+ md = RE2::Regexp.new('(wo{2})').match('woohoo' * 5)
139
+ GC.compact
140
+
141
+ expect(md[1]).to eq("woo")
142
+ end
136
143
  end
137
144
 
138
145
  describe "#string" do
@@ -287,6 +294,13 @@ RSpec.describe RE2::MatchData do
287
294
 
288
295
  expect { md.begin(nil) }.to raise_error(TypeError)
289
296
  end
297
+
298
+ it "supports GC compaction" do
299
+ md = RE2::Regexp.new('(wo{2})').match('woohoo' * 5)
300
+ GC.compact
301
+
302
+ expect(md.string[md.begin(0)..-1]).to eq('woohoo' * 5)
303
+ end
290
304
  end
291
305
 
292
306
  describe "#end" do
@@ -349,6 +363,13 @@ RSpec.describe RE2::MatchData do
349
363
 
350
364
  expect { md.end(nil) }.to raise_error(TypeError)
351
365
  end
366
+
367
+ it "supports GC compaction" do
368
+ md = RE2::Regexp.new('(wo{2})').match('woohoo' * 5)
369
+ GC.compact
370
+
371
+ expect(md.string[0...md.end(0)]).to eq('woo')
372
+ end
352
373
  end
353
374
 
354
375
  describe "#deconstruct" do
@@ -11,7 +11,39 @@ RSpec.describe RE2::Scanner do
11
11
  end
12
12
 
13
13
  describe "#string" do
14
- it "returns the original text for the scanner" do
14
+ it "returns the text for the scanner" do
15
+ re = RE2::Regexp.new('(\w+)')
16
+ text = "It is a truth"
17
+ scanner = re.scan(text)
18
+
19
+ expect(scanner.string).to eq("It is a truth")
20
+ end
21
+
22
+ it "returns a frozen string" do
23
+ re = RE2::Regexp.new('(\w+)')
24
+ text = "It is a truth"
25
+ scanner = re.scan(text)
26
+
27
+ expect(scanner.string).to be_frozen
28
+ end
29
+
30
+ it "freezes unfrozen strings" do
31
+ re = RE2::Regexp.new('(\w+)')
32
+ text = +"It is a truth"
33
+ scanner = re.scan(text)
34
+
35
+ expect(scanner.string).to be_frozen
36
+ end
37
+
38
+ it "copies unfrozen strings" do
39
+ re = RE2::Regexp.new('(\w+)')
40
+ text = +"It is a truth"
41
+ scanner = re.scan(text)
42
+
43
+ expect(scanner.string).to_not equal(text)
44
+ end
45
+
46
+ it "does not copy the string if it was already frozen" do
15
47
  re = RE2::Regexp.new('(\w+)')
16
48
  text = "It is a truth"
17
49
  scanner = re.scan(text)
@@ -162,6 +194,23 @@ RSpec.describe RE2::Scanner do
162
194
  expect(scanner.scan).to eq(["world"])
163
195
  expect(scanner.scan).to be_nil
164
196
  end
197
+
198
+ it "supports GC compaction" do
199
+ r = RE2::Regexp.new('(\w+)')
200
+ scanner = r.scan("Hello world" * 2)
201
+ GC.compact
202
+
203
+ expect(scanner.scan).to eq(["Hello"])
204
+ end
205
+
206
+ it "works even if the original input is mutated" do
207
+ r = RE2::Regexp.new('(\w+)')
208
+ text = +"It is a truth universally acknowledged"
209
+ scanner = r.scan(text)
210
+ text.upcase!
211
+
212
+ expect(scanner.scan).to eq(["It"])
213
+ end
165
214
  end
166
215
 
167
216
  it "is enumerable" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: re2
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.19.0
4
+ version: 2.21.0
5
5
  platform: x86_64-linux-musl
6
6
  authors:
7
7
  - Paul Mucur
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2025-08-07 00:00:00.000000000 Z
12
+ date: 2025-11-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake-compiler
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: 1.2.7
20
+ version: 1.3.0
21
21
  type: :development
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: 1.2.7
27
+ version: 1.3.0
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rake-compiler-dock
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -70,9 +70,6 @@ files:
70
70
  - ext/re2/extconf.rb
71
71
  - ext/re2/re2.cc
72
72
  - ext/re2/recipes.rb
73
- - lib/2.6/re2.so
74
- - lib/2.7/re2.so
75
- - lib/3.0/re2.so
76
73
  - lib/3.1/re2.so
77
74
  - lib/3.2/re2.so
78
75
  - lib/3.3/re2.so
@@ -103,7 +100,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
103
100
  requirements:
104
101
  - - ">="
105
102
  - !ruby/object:Gem::Version
106
- version: '2.6'
103
+ version: '3.1'
107
104
  - - "<"
108
105
  - !ruby/object:Gem::Version
109
106
  version: 3.5.dev
data/lib/2.6/re2.so DELETED
Binary file
data/lib/2.7/re2.so DELETED
Binary file
data/lib/3.0/re2.so DELETED
Binary file