[ruby-core:105632] [Ruby master Bug#14103] Regexp absense operator has no chance to ^C
From:
"jeremyevans0 (Jeremy Evans)" <noreply@...>
Date:
2021-10-13 15:49:00 UTC
List:
ruby-core #105632
Issue #14103 has been updated by jeremyevans0 (Jeremy Evans).
I submitted a pull request to fix this: https://github.com/ruby/ruby/pull/4960
The issue is unlikely to be specific to the absence operator, I think it affects any case where a regexp takes a long time due to backtracking. In addition to allowing interrupts, the pull request also allows yielding to other threads during a long regexp match (since checking for interrupts has that effect).
----------------------------------------
Bug #14103: Regexp absense operator has no chance to ^C
https://bugs.ruby-lang.org/issues/14103#change-94122
* Author: shyouhei (Shyouhei Urabe)
* Status: Open
* Priority: Normal
* ruby -v: ruby 2.5.0dev (2017-11-09 trunk 60720) [x86_64-darwin15]
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
Following script hangs, with no respond to `^C`.
```ruby
/(?<x> (?<! a ) a+ ){0}
(?<y> (?~ \g<z> ) ){0}
(?<z> (?<! a ) \k<x> (?! a ) ){0}
\g<x> \g<y> \g<z>
/xo =~ (1..1024).map{|x| 'b' + 'a' * x }.join
```
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>