re2 2.20.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: 820e5206d598404d26f2c704d4b267aa2b5da3f28da822b310fcf52092118314
4
- data.tar.gz: cb03349f715951f39dcebf0957da90663ca35c2dade533fdb54845db802e37bd
3
+ metadata.gz: 894ccd39ca4d27c1851d90ca1c1fab8d56f711ba825ff6c548fe1517bcb79d1d
4
+ data.tar.gz: 95bd05fffb687b4a2fc14b57e115660097fcfdf06d1401e5cdea1586e4d6f88d
5
5
  SHA512:
6
- metadata.gz: fd648abc0bfef2b2b0e749cd75b0bb3b059df29eadb373592d4ba59720ce1bd75f10b114b986ab7958fbed0310ea2d2a3477a9e792128d460b17baf67d9a7cf2
7
- data.tar.gz: b49ad2334e1b4592d402339d21b46d4fbe329f7f14b4a70a050abc5e4a0912c54312d1f650ec05e7d44b169871b4fca64374d2243fe8a4a3ad0f4c51411440e0
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.20.0
10
- **Bundled RE2 version:** libre2.11 (2025-08-12)
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
@@ -264,7 +264,7 @@ This gem requires the following to run:
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-12)
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
 
@@ -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
@@ -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-12'
4
- sha256: 2f3bec634c3e51ea1faf0d441e0a8718b73ef758d7020175ed7e352df3f6ae12
3
+ version: '2025-11-05'
4
+ sha256: 87f6029d2f6de8aa023654240a03ada90e876ce9a4676e258dd01ea4c26ffd67
5
5
  abseil:
6
6
  version: '20250814.1'
7
7
  sha256: 1692f77d1739bacf3f94337188b78583cf09bab7e420d2dc6c5605a4f86785a1
data/ext/re2/re2.cc CHANGED
@@ -128,13 +128,12 @@ static void parse_re2_options(RE2::Options* re2_options, const VALUE options) {
128
128
  static void re2_matchdata_mark(void *ptr) {
129
129
  re2_matchdata *m = reinterpret_cast<re2_matchdata *>(ptr);
130
130
  rb_gc_mark_movable(m->regexp);
131
- rb_gc_mark_movable(m->text);
131
+ rb_gc_mark(m->text);
132
132
  }
133
133
 
134
134
  static void re2_matchdata_compact(void *ptr) {
135
135
  re2_matchdata *m = reinterpret_cast<re2_matchdata *>(ptr);
136
136
  m->regexp = rb_gc_location(m->regexp);
137
- m->text = rb_gc_location(m->text);
138
137
  }
139
138
 
140
139
  static void re2_matchdata_free(void *ptr) {
@@ -173,13 +172,12 @@ static const rb_data_type_t re2_matchdata_data_type = {
173
172
  static void re2_scanner_mark(void *ptr) {
174
173
  re2_scanner *s = reinterpret_cast<re2_scanner *>(ptr);
175
174
  rb_gc_mark_movable(s->regexp);
176
- rb_gc_mark_movable(s->text);
175
+ rb_gc_mark(s->text);
177
176
  }
178
177
 
179
178
  static void re2_scanner_compact(void *ptr) {
180
179
  re2_scanner *s = reinterpret_cast<re2_scanner *>(ptr);
181
180
  s->regexp = rb_gc_location(s->regexp);
182
- s->text = rb_gc_location(s->text);
183
181
  }
184
182
 
185
183
  static void re2_scanner_free(void *ptr) {
@@ -278,10 +276,12 @@ static VALUE re2_matchdata_string(const VALUE self) {
278
276
  }
279
277
 
280
278
  /*
281
- * Returns the text supplied when incrementally matching with
279
+ * Returns a frozen copy of the text supplied when incrementally matching with
282
280
  * {RE2::Regexp#scan}.
283
281
  *
284
- * @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}
285
285
  * @example
286
286
  * c = RE2::Regexp.new('(\d+)').scan("foo")
287
287
  * c.string #=> "foo"
@@ -1614,10 +1614,13 @@ static VALUE re2_regexp_scan(const VALUE self, VALUE text) {
1614
1614
  VALUE scanner = rb_class_new_instance(0, 0, re2_cScanner);
1615
1615
  TypedData_Get_Struct(scanner, re2_scanner, &re2_scanner_data_type, c);
1616
1616
 
1617
- c->input = new(std::nothrow) re2::StringPiece(
1618
- RSTRING_PTR(text), RSTRING_LEN(text));
1619
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
+ }
1620
1621
  RB_OBJ_WRITE(scanner, &c->text, text);
1622
+ c->input = new(std::nothrow) re2::StringPiece(
1623
+ RSTRING_PTR(text), RSTRING_LEN(text));
1621
1624
 
1622
1625
  if (p->pattern->ok()) {
1623
1626
  c->number_of_capturing_groups = p->pattern->NumberOfCapturingGroups();
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.20.0"
13
+ VERSION = "2.21.0"
14
14
  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.20.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-09-26 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