Ruby Issue Tracking System: Issueshttps://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17097754782024-03-16T10:21:57ZRuby Issue Tracking System
Redmine Ruby master - Bug #20342 (Open): Top level `public`, `private` and `ruby2_keywords` do not work i...https://bugs.ruby-lang.org/issues/203422024-03-16T10:21:57Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<p>With this file:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="c1"># load.rb</span>
<span class="kp">public</span> <span class="k">def</span> <span class="nf">f</span> <span class="o">=</span> <span class="ss">:ok</span>
</code></pre>
<p>It is OK when <code>require</code>d.</p>
<pre><code data-language="sh-session">$ ruby -r ./load.rb -e 'p f'
:ok
</code></pre>
<p>Simple <code>load</code> is OK too.</p>
<pre><code data-language="sh-session">$ ruby -e 'load ARGV[0]; p f' load.rb
:ok
</code></pre>
<p>Wrapped <code>load</code> fails.</p>
<pre><code data-language="sh-session">$ ruby -e 'load ARGV[0], true' load.rb
load.rb:1:in 'public': undefined method 'f' for class 'Object' (NameError)
public def f = :ok
^^^^^^
from load.rb:1:in '<top (required)>'
from -e:1:in 'Kernel#load'
from -e:1:in '<main>'
</code></pre> Ruby master - Bug #20340 (Open): Ractor comments not applying to constant targetshttps://bugs.ruby-lang.org/issues/203402024-03-14T19:39:40Zkddnewton (Kevin Newton)kddnewton@gmail.com
<p>In this example:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="no">C</span><span class="p">,</span> <span class="o">=</span> <span class="p">{</span> <span class="ss">foo: </span><span class="n">bar</span> <span class="p">}</span>
</code></pre>
<p>You get:</p>
<pre><code>== disasm: #<ISeq:<main>@test.rb:1 (1,0)-(1,17)>
0000 putobject :foo ( 1)[Li]
0002 putself
0003 opt_send_without_block <calldata!mid:bar, argc:0, FCALL|VCALL|ARGS_SIMPLE>
0005 newhash 2
0007 dup
0008 expandarray 1, 0
0011 putspecialobject 3
0013 setconstant :C
0015 leave
</code></pre>
<p>But there's no difference from:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="c1"># shareable_constant_value: literal</span>
<span class="no">C</span><span class="p">,</span> <span class="o">=</span> <span class="p">{</span> <span class="ss">foo: </span><span class="n">bar</span> <span class="p">}</span>
</code></pre>
<p>I would have expected:</p>
<pre><code>== disasm: #<ISeq:<main>@test.rb:1 (1,0)-(2,16)>
0000 putobject RubyVM::FrozenCore ( 2)[Li]
0002 putobject :foo
0004 putobject RubyVM::FrozenCore
0006 putself
0007 opt_send_without_block <calldata!mid:bar, argc:0, FCALL|VCALL|ARGS_SIMPLE>
0009 putobject "C"
0011 opt_send_without_block <calldata!mid:ensure_shareable, argc:2, ARGS_SIMPLE>
0013 newhash 2
0015 opt_send_without_block <calldata!mid:make_shareable, argc:1, ARGS_SIMPLE>
0017 dup
0018 expandarray 1, 0
0021 putspecialobject 3
0023 setconstant :C
0025 leave
</code></pre>
<p>Is this omission intentional? For context, I'm building this in prism and I need to know if I should explicitly disable this behavior.</p> Ruby master - Bug #20319 (Open): Singleton class is being frozen lazily in some caseshttps://bugs.ruby-lang.org/issues/203192024-03-01T11:52:12Zandrykonchin (Andrew Konchin)
<p>I've noticed suspicious behaviour (it doesn't affect anything in practice for me though) when an object becomes frozen only its own singleton class becomes frozen immediately.</p>
<p>A singleton class of the object immediate singleton class becomes frozen lazily after <code>#singleton_class</code> method call:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="n">o</span> <span class="o">=</span> <span class="no">Object</span><span class="p">.</span><span class="nf">new</span>
<span class="n">klass</span> <span class="o">=</span> <span class="n">o</span><span class="p">.</span><span class="nf">singleton_class</span><span class="p">.</span><span class="nf">singleton_class</span>
<span class="n">o</span><span class="p">.</span><span class="nf">freeze</span>
<span class="nb">puts</span> <span class="n">klass</span><span class="p">.</span><span class="nf">frozen?</span> <span class="c1"># false <== here we expect true</span>
<span class="nb">puts</span> <span class="n">o</span><span class="p">.</span><span class="nf">singleton_class</span><span class="p">.</span><span class="nf">singleton_class</span><span class="p">.</span><span class="nf">frozen?</span> <span class="c1"># true</span>
<span class="nb">puts</span> <span class="n">klass</span><span class="p">.</span><span class="nf">frozen?</span> <span class="c1"># true</span>
</code></pre>
<p>I would expect all created (and visible to user) singleton classes in an object singleton classes chain to become frozen immediately when the object gets frozen.</p> Ruby master - Bug #20316 (Open): Regexp quantifier behavior changes in different syntactic context.https://bugs.ruby-lang.org/issues/203162024-02-29T17:21:18Zjirkamarsik (Jirka Marsik)
<p>In the example below, adding a vertical bar to the end of a regular expression changes what is being matched by the preceding regular expression.</p>
<pre><code>irb(main):001:0> /(|a){3}b/.match("aab")
=> #<MatchData "aab" 1:"">
irb(main):002:0> /(|a){3}b|/.match("aab")
=> #<MatchData "aab" 1:"a">
</code></pre>
<p>This is because the <code>{3}</code> quantifier is compiled into a <code>repeat</code> loop which uses the <code>OP_NULL_CHECK_END_MEMST</code> operation to perform a capture-group sensitive null-check after every loop iteration. The logic behind the <code>OP_NULL_CHECK_END_MEMST</code> operation is implemented using the <code>STACK_NULL_CHECK_MEMST</code> macro in <code>regexec.c</code>. The <code>STACK_NULL_CHECK_MEMST</code> macro checks whether any capture groups have been updated inside the last loop iteration and it does so by searching the stack for <code>STK_MEM_START</code> entries. However, such entries are not used for all capture groups. They are only used by capture groups which are listed in <code>bt_mem_start</code>. A capture group is marked as needing such bookkeeping only when it is either referenced by a back-reference or it appears in certain syntactic contexts (see e.g. around line 4096 of <code>regcomp.c</code>). This looks like an optimization that tries to avoid polluting the stack with <code>STK_MEM_START</code> entries in cases in which they are not needed. However, in this case, not putting <code>STK_MEM_START</code> entries on the stack leads to a different match result.</p>
<p>In the example above, by adding a vertical bar to the end of the regexp, we have placed the group <code>(|a)</code> inside an alternation. This means that a different operation for tracking the state of the capture group is emitted in the compiled bytecode and this leads to a different result. Incidentally, this result should be the correct result, as the null-check ends up respecting the state of capture groups, as it tries to do in Ruby.</p>
<p>This is the compilation and execution of <code>/(|a){3}b/.match("aab")</code> with ONIG_DEBUG_PARSE_TREE, ONIG_DEBUG_COMPILE and ONIG_DEBUG_MATCH. Note that <code>mem-start:1</code> is used for tracking the state of capture group 1.</p>
<pre><code>PATTERN: /(|a){3}b/ (US-ASCII)
<list:55db929991f0>
<quantifier:55db92999230>{3,3}
<enclose:55db92999330> memory:1
<alt:55db929991b0>
<string:55db929992f0>
<string:55db929992b0>a
<string:55db929993b0>b
optimize: EXACT
anchor: []
sub anchor: []
exact: [b]: length: 1
code length: 37
0:[repeat:0:27] 7:[null-check-start:0] 10:[mem-start:1] 13:[push:(+5)] 18:[jump:(+2)]
23:[exact1:a] 25:[mem-end:1] 28:[null-check-end-memst:0] 31:[repeat-inc:0] 34:[exact1:b]
36:[end]
match_at: str: 139809364021904 (0x7f27e77a9290), end: 139809364021906 (0x7f27e77a9292), start: 139809364021904 (0x7f27e77a9290), sprev: 0 ((nil))
size: 2, start offset: 0
ofs> str stk:type addr:opcode
0> "ab" 0:Alt 0:[repeat:0:27]
0> "ab" 1:Rep 7:[null-check-start:0]
0> "ab" 2:NulChS 10:[mem-start:1]
0> "ab" 2:NulChS 13:[push:(+5)]
0> "ab" 3:Alt 18:[jump:(+2)]
0> "ab" 3:Alt 25:[mem-end:1]
0> "ab" 3:Alt 28:[null-check-end-memst:0]
NULL_CHECK_END_MEMST: skip id:0, s:139809364021904 (0x7f27e77a9290)
0> "ab" 3:Alt 34:[exact1:b]
0> "ab" 2:NulChS 23:[exact1:a]
1> "b" 2:NulChS 25:[mem-end:1]
1> "b" 2:NulChS 28:[null-check-end-memst:0]
1> "b" 2:NulChS 31:[repeat-inc:0]
1> "b" 3:RepInc 7:[null-check-start:0]
1> "b" 4:NulChS 10:[mem-start:1]
1> "b" 4:NulChS 13:[push:(+5)]
1> "b" 5:Alt 18:[jump:(+2)]
1> "b" 5:Alt 25:[mem-end:1]
1> "b" 5:Alt 28:[null-check-end-memst:0]
NULL_CHECK_END_MEMST: skip id:0, s:139809364021905 (0x7f27e77a9291)
1> "b" 5:Alt 34:[exact1:b]
2> "" 5:Alt 36:[end]
</code></pre>
<p>This is the compilation and execution of <code>/(|a){3}b|/.match("aab")</code> (where the group <code>(|a)</code> appears inside an alternation) with ONIG_DEBUG_PARSE_TREE, ONIG_DEBUG_COMPILE and ONIG_DEBUG_MATCH. Note that <code>mem-start-push:1</code> is used for tracking the state of capture group 1, not <code>mem-start:1</code>.</p>
<pre><code>PATTERN: /(|a){3}b|/ (US-ASCII)
<alt:55d9a91cc3c0>
<list:55d9a91cc200>
<quantifier:55d9a91cc240>{3,3}
<enclose:55d9a91cc340> memory:1
<alt:55d9a91cc1c0>
<string:55d9a91cc300>
<string:55d9a91cc2c0>a
<string:55d9a91cc480>b
<string:55d9a91cc400>
optimize: NONE
anchor: []
code length: 47
0:[push:(+41)] 5:[repeat:0:27] 12:[null-check-start:0] 15:[mem-start-push:1] 18:[push:(+5)]
23:[jump:(+2)] 28:[exact1:a] 30:[mem-end:1] 33:[null-check-end-memst:0] 36:[repeat-inc:0]
39:[exact1:b] 41:[jump:(+0)] 46:[end]
match_at: str: 140072854131304 (0x7f6540b69268), end: 140072854131306 (0x7f6540b6926a), start: 140072854131304 (0x7f6540b69268), sprev: 0 ((nil))
size: 2, start offset: 0
ofs> str stk:type addr:opcode
0> "ab" 0:Alt 0:[push:(+41)]
0> "ab" 1:Alt 5:[repeat:0:27]
0> "ab" 2:Rep 12:[null-check-start:0]
0> "ab" 3:NulChS 15:[mem-start-push:1]
0> "ab" 4:MemS 18:[push:(+5)]
0> "ab" 5:Alt 23:[jump:(+2)]
0> "ab" 5:Alt 30:[mem-end:1]
0> "ab" 5:Alt 33:[null-check-end-memst:0]
0> "ab" 5:Alt 36:[repeat-inc:0]
0> "ab" 6:RepInc 12:[null-check-start:0]
0> "ab" 7:NulChS 15:[mem-start-push:1]
0> "ab" 8:MemS 18:[push:(+5)]
0> "ab" 9:Alt 23:[jump:(+2)]
0> "ab" 9:Alt 30:[mem-end:1]
0> "ab" 9:Alt 33:[null-check-end-memst:0]
NULL_CHECK_END_MEMST: skip id:0, s:140072854131304 (0x7f6540b69268)
0> "ab" 9:Alt 39:[exact1:b]
0> "ab" 8:MemS 28:[exact1:a]
1> "b" 8:MemS 30:[mem-end:1]
1> "b" 8:MemS 33:[null-check-end-memst:0]
1> "b" 8:MemS 36:[repeat-inc:0]
1> "b" 9:RepInc 12:[null-check-start:0]
1> "b" 10:NulChS 15:[mem-start-push:1]
1> "b" 11:MemS 18:[push:(+5)]
1> "b" 12:Alt 23:[jump:(+2)]
1> "b" 12:Alt 30:[mem-end:1]
1> "b" 12:Alt 33:[null-check-end-memst:0]
1> "b" 12:Alt 36:[repeat-inc:0]
1> "b" 13:RepInc 39:[exact1:b]
2> "" 13:RepInc 41:[jump:(+0)]
2> "" 13:RepInc 46:[end]
</code></pre> Ruby master - Bug #20315 (Open): Quantifier expansion leads to different results in Regexp.https://bugs.ruby-lang.org/issues/203152024-02-29T16:59:34Zjirkamarsik (Jirka Marsik)
<p>Consider the following series of regular expression matches:</p>
<pre><code>irb(main):001:0> /(|a)(|a)(|a)(|a)(|a)b/.match("aaaab")
=> #<MatchData "aaaab" 1:"" 2:"a" 3:"a" 4:"a" 5:"a">
irb(main):002:0> /(|a)(|a)(|a)(|a)b/.match("aaab")
=> #<MatchData "aaab" 1:"" 2:"a" 3:"a" 4:"a">
irb(main):003:0> /(|a)(|a)(|a)b/.match("aab")
=> #<MatchData "aab" 1:"" 2:"a" 3:"a">
irb(main):004:0> /(|a)(|a)b/.match("ab")
=> #<MatchData "ab" 1:"" 2:"a">
</code></pre>
<p>Let <code>X^{N}</code> mean <code>N</code> concatenated repetitions of <code>X</code>. When matching the pattern <code>/(|a)^{N}b/</code> against <code>a^{N-1}b</code>, the first group will match the empty string and the last <code>N-1</code> groups will match <code>a</code>.</p>
<p>Now, let's look at this series of similar expressions, in which <code>(|a)^{N}</code> is replaced with <code>(|a){N}</code>, i.e. a counted quantifier.</p>
<pre><code>irb(main):001:0> /(|a){5}b/.match("aaaab")
=> #<MatchData "aaaab" 1:"">
irb(main):002:0> /(|a){4}b/.match("aaab")
=> #<MatchData "aaab" 1:"">
irb(main):003:0> /(|a){3}b/.match("aab")
=> #<MatchData "aab" 1:"">
irb(main):004:0> /(|a){2}b/.match("ab")
=> #<MatchData "ab" 1:"a">
</code></pre>
<p>When matching the pattern <code>/(|a){N}b/</code> against <code>a^{N-1}b</code>, the first <code>N-1</code> iterations will match <code>a</code> and the <code>N</code>-th iteration will match the empty string (compare this with the behavior of the first series of expressions). However, something strange happens when <code>N</code> is 2. We end up getting a result which is not consistent with this series, but looks like a result that belongs to the first series discussed above.</p>
<p>This is due to quantifier expansion done by the regexp compiler (see usages of <code>QUANTIFIER_EXPAND_LIMIT_SIZE</code> in <code>regcomp.c</code>). This is an optimization that tries to remove the overhead of managing a counted repetition during regex execution at the cost of increasing the size of the compiled regex bytecode. The source of the inconsistency is caused by the fact that this optimization can actually change the semantics of the regular expression, because as we have seen above, <code>X^{N}</code> (<code>X</code> repeated <code>N</code> times) can have different semantics from <code>X{N}</code> (a single <code>X</code> with an <code>{N}</code> quantifier).</p>
<p>Compilation and execution of <code>/(|a){3}b/.match("aab")</code> with <code>ONIG_DEBUG_PARSE_TREE</code>, <code>ONIG_DEBUG_COMPILE</code> and <code>ONIG_DEBUG_MATCH</code>:</p>
<pre><code>PATTERN: /(|a){3}b/ (US-ASCII)
<list:556161bb11f0>
<quantifier:556161bb1230>{3,3}
<enclose:556161bb1330> memory:1
<alt:556161bb11b0>
<string:556161bb12f0>
<string:556161bb12b0>a
<string:556161bb13b0>b
optimize: EXACT
anchor: []
sub anchor: []
exact: [b]: length: 1
code length: 37
0:[repeat:0:27] 7:[null-check-start:0] 10:[mem-start:1] 13:[push:(+5)] 18:[jump:(+2)]
23:[exact1:a] 25:[mem-end:1] 28:[null-check-end-memst:0] 31:[repeat-inc:0] 34:[exact1:b]
36:[end]
match_at: str: 140607416406704 (0x7fe1b71b92b0), end: 140607416406706 (0x7fe1b71b92b2), start: 140607416406704 (0x7fe1b71b92b0), sprev: 0 ((nil))
size: 2, start offset: 0
ofs> str stk:type addr:opcode
0> "ab" 0:Alt 0:[repeat:0:27]
0> "ab" 1:Rep 7:[null-check-start:0]
0> "ab" 2:NulChS 10:[mem-start:1]
0> "ab" 2:NulChS 13:[push:(+5)]
0> "ab" 3:Alt 18:[jump:(+2)]
0> "ab" 3:Alt 25:[mem-end:1]
0> "ab" 3:Alt 28:[null-check-end-memst:0]
NULL_CHECK_END_MEMST: skip id:0, s:140607416406704 (0x7fe1b71b92b0)
0> "ab" 3:Alt 34:[exact1:b]
0> "ab" 2:NulChS 23:[exact1:a]
1> "b" 2:NulChS 25:[mem-end:1]
1> "b" 2:NulChS 28:[null-check-end-memst:0]
1> "b" 2:NulChS 31:[repeat-inc:0]
1> "b" 3:RepInc 7:[null-check-start:0]
1> "b" 4:NulChS 10:[mem-start:1]
1> "b" 4:NulChS 13:[push:(+5)]
1> "b" 5:Alt 18:[jump:(+2)]
1> "b" 5:Alt 25:[mem-end:1]
1> "b" 5:Alt 28:[null-check-end-memst:0]
NULL_CHECK_END_MEMST: skip id:0, s:140607416406705 (0x7fe1b71b92b1)
1> "b" 5:Alt 34:[exact1:b]
2> "" 5:Alt 36:[end]
</code></pre>
<p>Compilation and execution of <code>/(|a){2}b/.match("ab")</code> with <code>ONIG_DEBUG_PARSE_TREE</code>, <code>ONIG_DEBUG_COMPILE</code> and <code>ONIG_DEBUG_MATCH</code>:</p>
<pre><code>PATTERN: /(|a){2}b/ (US-ASCII)
<list:55bbc826c1f0>
<quantifier:55bbc826c230>{2,2}
<enclose:55bbc826c330> memory:1
<alt:55bbc826c1b0>
<string:55bbc826c2f0>
<string:55bbc826c2b0>a
<string:55bbc826c3b0>b
optimize: EXACT
anchor: []
sub anchor: []
exact: [b]: length: 1
code length: 39
0:[mem-start:1] 3:[push:(+5)] 8:[jump:(+2)] 13:[exact1:a] 15:[mem-end:1]
18:[mem-start:1] 21:[push:(+5)] 26:[jump:(+2)] 31:[exact1:a] 33:[mem-end:1]
36:[exact1:b] 38:[end]
match_at: str: 140139875963504 (0x7f74db869270), end: 140139875963506 (0x7f74db869272), start: 140139875963504 (0x7f74db869270), sprev: 0 ((nil))
size: 2, start offset: 0
ofs> str stk:type addr:opcode
0> "ab" 0:Alt 0:[mem-start:1]
0> "ab" 0:Alt 3:[push:(+5)]
0> "ab" 1:Alt 8:[jump:(+2)]
0> "ab" 1:Alt 15:[mem-end:1]
0> "ab" 1:Alt 18:[mem-start:1]
0> "ab" 1:Alt 21:[push:(+5)]
0> "ab" 2:Alt 26:[jump:(+2)]
0> "ab" 2:Alt 33:[mem-end:1]
0> "ab" 2:Alt 36:[exact1:b]
0> "ab" 1:Alt 31:[exact1:a]
1> "b" 1:Alt 33:[mem-end:1]
1> "b" 1:Alt 36:[exact1:b]
2> "" 1:Alt 38:[end]
</code></pre> Ruby master - Bug #20314 (Open): Simultaneous Timeout expires may raise an exception after the blockhttps://bugs.ruby-lang.org/issues/203142024-02-29T06:25:26Zmame (Yusuke Endoh)mame@ruby-lang.org
<p>Launchable reports <code>TestTimeout#test_nested_timeout</code> as a flaky test, and I reproduced it as follows.</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="nb">require</span> <span class="s2">"timeout"</span>
<span class="k">class</span> <span class="nc">A</span> <span class="o"><</span> <span class="no">Exception</span>
<span class="k">end</span>
<span class="k">class</span> <span class="nc">B</span> <span class="o"><</span> <span class="no">Exception</span>
<span class="k">end</span>
<span class="k">begin</span>
<span class="no">Timeout</span><span class="p">.</span><span class="nf">timeout</span><span class="p">(</span><span class="mf">0.1</span><span class="p">,</span> <span class="no">A</span><span class="p">)</span> <span class="k">do</span>
<span class="no">Timeout</span><span class="p">.</span><span class="nf">timeout</span><span class="p">(</span><span class="mf">0.1</span><span class="p">,</span> <span class="no">B</span><span class="p">)</span> <span class="k">do</span>
<span class="kp">nil</span> <span class="k">while</span> <span class="kp">true</span>
<span class="k">end</span>
<span class="k">end</span>
<span class="k">rescue</span> <span class="no">A</span><span class="p">,</span> <span class="no">B</span>
<span class="nb">p</span> <span class="vg">$!</span> <span class="c1">#=> #<A: execution expired></span>
<span class="c1"># Exception B is raised after the above call returns</span>
<span class="c1">#=> test.rb:16:in `p': execution expired (B)</span>
<span class="nb">p</span> <span class="ss">:end</span> <span class="c1"># not reach</span>
<span class="k">end</span>
</code></pre>
<p>This is because the timer thread performs two consecutive <code>Thread#raise</code> to the target thread.</p>
<p>I have discussed this with <a class="user active user-mention" href="https://bugs.ruby-lang.org/users/17">@ko1 (Koichi Sasada)</a> and have come up with three solutions.</p>
<a name="Solution-1"></a>
<h3 >Solution 1<a href="#Solution-1" class="wiki-anchor">¶</a></h3>
<p>When multiple nested Timeouts expire simultaneously, raise an exception for the outer-most Timeout and let the inner Timeouts expire without throwing an exception. In the above example, it would only raise A.</p>
<p>The problem with this approach is that if you are rescuing A in the inner block, it may never ends:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="no">Timeout</span><span class="p">.</span><span class="nf">timeout</span><span class="p">(</span><span class="mf">0.1</span><span class="p">,</span> <span class="no">A</span><span class="p">)</span> <span class="k">do</span>
<span class="no">Timeout</span><span class="p">.</span><span class="nf">timeout</span><span class="p">(</span><span class="mf">0.1</span><span class="p">,</span> <span class="no">B</span><span class="p">)</span> <span class="k">do</span>
<span class="k">begin</span>
<span class="nb">sleep</span>
<span class="k">rescue</span> <span class="no">A</span>
<span class="nb">sleep</span> <span class="c1"># The exception A is caught. The inner Timeout is already expired, so the code (may) never end.</span>
<span class="k">end</span>
<span class="k">end</span>
<span class="k">end</span>
</code></pre>
<p>Note that, if A and B did not occur at the same time, it would raise B. This is a race condition.</p>
<a name="Solution-2"></a>
<h3 >Solution 2<a href="#Solution-2" class="wiki-anchor">¶</a></h3>
<p>When multiple nested Timeouts expire simultaneously, raise an exception for the inner-most Timeout and let the outer Timeouts wait until the inner-most Timeout returns. In the above example, it would raise either A or B, not both.</p>
<p>The problem with this approach is that if you are rescuing B in the inner block, it never ends:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="no">Timeout</span><span class="p">.</span><span class="nf">timeout</span><span class="p">(</span><span class="mf">0.1</span><span class="p">,</span> <span class="no">A</span><span class="p">)</span> <span class="k">do</span>
<span class="no">Timeout</span><span class="p">.</span><span class="nf">timeout</span><span class="p">(</span><span class="mf">0.1</span><span class="p">,</span> <span class="no">B</span><span class="p">)</span> <span class="k">do</span>
<span class="k">begin</span>
<span class="nb">sleep</span>
<span class="k">rescue</span> <span class="no">B</span>
<span class="nb">sleep</span> <span class="c1"># The outer Timeout waits for the inner timeout, and the inner Timeout never return. So this code never ends.</span>
<span class="k">end</span>
<span class="k">end</span>
<span class="k">end</span>
</code></pre>
<a name="Solution-3"></a>
<h3 >Solution 3<a href="#Solution-3" class="wiki-anchor">¶</a></h3>
<p>Make thread interrupt queue one length. If the target thread has already been <code>Thread#raise(A)</code>, the new <code>Thread#raise(B)</code> blocks until the target thread processes A.</p>
<p>Since there will be no more simultaneous Thread#raise, there will be no more exceptions after the end of the block. The timeout timer thread should be changed in consideration that <code>Thread#raise</code> may block.</p> Ruby master - Bug #20301 (Open): `Set#add?` does two hash look-upshttps://bugs.ruby-lang.org/issues/203012024-02-26T02:42:35ZAMomchilov (Alexander Momchilov)
<p>A common usage of <code>Set</code>s is to keep track of seen objects, and do something different whenever an object is seen for the first time, e.g.:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="no">SEEN_VALUES</span> <span class="o">=</span> <span class="no">Set</span><span class="p">.</span><span class="nf">new</span>
<span class="k">def</span> <span class="nf">receive_value</span><span class="p">(</span><span class="n">value</span><span class="p">)</span>
<span class="k">if</span> <span class="no">SEEN_VALUES</span><span class="p">.</span><span class="nf">add?</span><span class="p">(</span><span class="n">value</span><span class="p">)</span>
<span class="nb">puts</span> <span class="s2">"Saw </span><span class="si">#{</span><span class="n">value</span><span class="si">}</span><span class="s2"> for the first time."</span>
<span class="k">else</span>
<span class="nb">puts</span> <span class="s2">"Already seen </span><span class="si">#{</span><span class="n">value</span><span class="si">}</span><span class="s2">, ignoring."</span>
<span class="k">end</span>
<span class="k">end</span>
<span class="n">receive_value</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span> <span class="c1"># Saw 1 for the first time.</span>
<span class="n">receive_value</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span> <span class="c1"># Saw 2 for the first time.</span>
<span class="n">receive_value</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span> <span class="c1"># Saw 3 for the first time.</span>
<span class="n">receive_value</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span> <span class="c1"># Already seen 1, ignoring.</span>
</code></pre>
<p>Readers might reasonably assume that <code>add?</code> is only looking up into the set a single time, but it's actually doing two separate look-ups! (<a href="https://github.com/ruby/ruby/blob/c976cb5/lib/set.rb#L517-L525" class="external">source</a>)</p>
<pre><code class="rb syntaxhl" data-language="rb"><span class="k">class</span> <span class="nc">Set</span>
<span class="k">def</span> <span class="nf">add?</span><span class="p">(</span><span class="n">o</span>
<span class="c1"># 1. `include?(o)` looks up into `@hash`</span>
<span class="c1"># 2. if the value isn't there, `add(o)` does a second look-up into `@hash`</span>
<span class="n">add</span><span class="p">(</span><span class="n">o</span><span class="p">)</span> <span class="k">unless</span> <span class="kp">include</span><span class="p">?(</span><span class="n">o</span><span class="p">)</span>
<span class="k">end</span>
<span class="k">end</span>
</code></pre>
<p>This gets especially expensive if the values are large hash/arrays/objects, whose <code>#hash</code> is expensive to compute.</p>
<p>We can optimize this if it was possible to set a value in hash, <em>and</em> retrieve the value that was already there, in a single go. I propose adding <code>Hash#exchange_value</code> to do exactly that. If that existed, we can re-implement <code>#add?</code> as:</p>
<pre><code class="rb syntaxhl" data-language="rb"><span class="k">class</span> <span class="nc">Set</span>
<span class="k">def</span> <span class="nf">add?</span><span class="p">(</span><span class="n">o</span><span class="p">)</span>
<span class="c1"># Only requires a single look-up into `@hash`!</span>
<span class="nb">self</span> <span class="k">unless</span> <span class="vi">@hash</span><span class="p">.</span><span class="nf">exchange_value</span><span class="p">(</span><span class="n">o</span><span class="p">,</span> <span class="kp">true</span><span class="p">)</span>
<span class="k">end</span>
</code></pre>
<p>Here's a proof-of-concept implementation: <a href="https://github.com/ruby/ruby/pull/10093" class="external">https://github.com/ruby/ruby/pull/10093</a></p>
<a name="Theory"></a>
<h1 >Theory<a href="#Theory" class="wiki-anchor">¶</a></h1>
<p>How much of a benefit this has depends on 2 factors:</p>
<ol>
<li>How much <code>#hash</code> is called, which depends on how many <strong>new</strong> objects are added to the set.
<ul>
<li>If every object is new, then <code>#hash</code> used to be called twice on every <code>#add?</code>.
<ul>
<li>This is where this improvement makes the biggest (2x!) change.</li>
</ul>
</li>
<li>If every object has already been seen, then <code>#hash</code> was never being called twice before anyway, so there would be no improvement.
<ul>
<li>It's important to not regress in this case, because many use cases of sets don't deal with many distinct objects, but just need to do quick checks against an existing set.</li>
</ul>
</li>
<li>Every other case lies somewhere in between those two, depending on the % of objects which are new.</li>
</ul>
</li>
<li>How slow <code>#hash</code> is to compute for the key
<ul>
<li>If the hash is slow to compute, this change will make a bigger improvement</li>
<li>If the hash value is fast to compute, then it won't matter as much. Even if we called it half as much, it's a minority of the total time, so it won't have much net impact.</li>
</ul>
</li>
</ol>
<a name="Benchmark-summary"></a>
<h1 >Benchmark summary<a href="#Benchmark-summary" class="wiki-anchor">¶</a></h1>
<table>
<thead>
<tr>
<th></th>
<th align="right">All objects are new</th>
<th align="right">All objects are preexisting</th>
</tr>
</thead>
<tbody>
<tr>
<td>objects with slow <code>#hash</code>
</td>
<td align="right">100.0%</td>
<td align="right">~0.0%</td>
</tr>
<tr>
<td>objects with fast <code>#hash</code>
</td>
<td align="right">24.5%</td>
<td align="right">4.6%</td>
</tr>
</tbody>
</table>
<p>As we see, this change makes a huge improvement the cases where it helps, and crucially, doesn't slow down the cases where it can't.</p>
<p>For the complete benchmark source code and results, see the PR: <a href="https://github.com/ruby/ruby/pull/10093" class="external">https://github.com/ruby/ruby/pull/10093</a></p> Ruby master - Bug #20299 (Open): Tracepoint staying enable after a disablehttps://bugs.ruby-lang.org/issues/202992024-02-26T01:06:28ZMaxLap (Maxime Lapointe)hunter_spawn@hotmail.com
<p>Problem is present in Ruby 3.2.2, 3.2.3, 3.3.0. Didn't check before.</p>
<p>It seems that TracePoint can sometime be "stuck" enabled after using disabled once on it.</p>
<p>Here is a reproduction step using a "check speed" method that just does some work and print out how long it takes. This makes it pretty clear when TracePoint was on.</p>
<p>Put this in a Ruby file:</p>
<pre><code>def check_speed(msg)
t1 = Time.now.to_f
a = 0
1000000.times { |i|
a += 10
}
t2 = Time.now.to_f
puts "#{t2-t1} - #{msg}"
end
check_speed("before") # fast
trace = TracePoint.new(:line) {}
trace.enable
check_speed("after enable") # slow
trace.enable {
check_speed("in block enable") # slow
}
check_speed("after block enable") # slow
trace.disable
check_speed("after disable") # slow !!!!
trace.disable
check_speed("after disable again") # fast !!!!
# And yet, using enable multiple time doesn't have a "counter" or similar
trace.enable
trace.enable
trace.enable
check_speed("after triple enable") # slow
trace.disable
check_speed("after single disable") # fast
</code></pre>
<p>Running the file, we get this:</p>
<pre><code>$ ruby -v
ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [x86_64-linux]
$ ruby local.rb
0.03473854064941406 - before
0.18935227394104004 - after enable
0.17757630348205566 - in block enable
0.18320131301879883 - after block enable
0.1818866729736328 - after disable
0.03412747383117676 - after disable again
0.18405628204345703 - after triple enable
0.033496856689453125 - after single disable
</code></pre>
<p>The first "after disable" should probably have been fast. If it's possible to have multiple nested enable/disable, then one would instead assume that after the last "single disable", things would still be slow.</p>
<p>Note: This code patterns comes directly for a ruby/spec: ctrl+f for "enables trace object on calling with a block if it was already enabled"</p>
<p>I note that in Ruby 3.2, the timing are a lot less similar. I don't know why. It would seem like TracePoint got slower in Ruby 3.3.0. Is that worth checking out / making a distincct bug for?</p>
<pre><code>$ rvm use 3.2.3
Using /home/max/.rvm/gems/ruby-3.2.3
$ ruby local.rb
0.03246927261352539 - before
0.07910513877868652 - after enable
0.10309600830078125 - in block enable
0.12397646903991699 - after block enable
0.07114601135253906 - after disable
0.028218746185302734 - after disable again
0.12534689903259277 - after triple enable
0.02810525894165039 - after single disable
</code></pre> Ruby master - Bug #20262 (Open): Regex mismatch between Ruby 3.2.2 and 3.3.0https://bugs.ruby-lang.org/issues/202622024-02-13T06:28:11Zweilandia (Nick Weiland)
<p>This might be a duplicate of <a href="https://bugs.ruby-lang.org/issues/20098" class="external">https://bugs.ruby-lang.org/issues/20098</a>, but I cannot make it match with the backref so maybe not.</p>
<p>Below example matches in 3.2.2 but not in 3.3.0</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="n">str</span> <span class="o">=</span> <span class="s2">"------------abcdefg------------#3895912"</span>
<span class="n">re</span> <span class="o">=</span> <span class="sr">/()\1\b\w*[a-zA-Z-]*\d+[\w-]{3,}\w+\b/</span>
<span class="n">re</span><span class="p">.</span><span class="nf">match?</span><span class="p">(</span><span class="n">str</span><span class="p">)</span>
</code></pre> Ruby master - Bug #20203 (Open): `TestEnumerable` test failures with GCC 14https://bugs.ruby-lang.org/issues/202032024-01-22T17:10:42Zvo.x (Vit Ondruch)v.ondruch@tiscali.cz
<p>There is ongoing mass rebuild in Fedora and that is first time GCC 14 is used and we observe test failures in <code>TestEnumerable</code>. Here are a few examples:</p>
<pre><code>[ 3000/26419] TestEnumerable#test_transient_heap_sort_bymalloc_consolidate(): unaligned fastbin chunk detected
</code></pre>
<pre><code>[ 2455/26535] TestEnumerable#test_transient_heap_sort_bycorrupted size vs. prev_size in fastbins
</code></pre>
<pre><code>[ 9716/26532] TestEnumerable#test_any_with_unused_blockdouble free or corruption (fasttop)
</code></pre>
<p>The full logs are accessible <a href="https://koji.fedoraproject.org/koji/taskinfo?taskID=112176941" class="external">here</a>. Please drill through <code>Descendants</code> and <code>build.log</code></p> Ruby master - Bug #20189 (Open): `rb_str_resize` does not clear coderange when expandinghttps://bugs.ruby-lang.org/issues/201892024-01-16T12:56:47Ztompng (tomoya ishida)tomoyapenguin@gmail.com
<p>Expanding string in some encoding (utf16 utf32) can change coderange to either valid or broken, but rb_str_resize does not clear coderange.</p>
<p>This will cause a bug in c-extension libraries that use rb_str_resize.</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="c1"># Example for stringio</span>
<span class="n">s</span> <span class="o">=</span> <span class="no">StringIO</span><span class="p">.</span><span class="nf">new</span><span class="p">(</span><span class="s2">"</span><span class="se">\0</span><span class="s2">"</span><span class="p">.</span><span class="nf">encode</span><span class="p">(</span><span class="s1">'UTF-16LE'</span><span class="p">))</span>
<span class="n">s</span><span class="p">.</span><span class="nf">truncate</span><span class="p">(</span><span class="mi">1</span><span class="p">);</span> <span class="n">s</span><span class="p">.</span><span class="nf">truncate</span><span class="p">(</span><span class="mi">2</span><span class="p">);</span> <span class="n">s</span><span class="p">.</span><span class="nf">string</span><span class="p">.</span><span class="nf">valid_encoding?</span>
<span class="c1">#=> true</span>
<span class="n">s</span><span class="p">.</span><span class="nf">truncate</span><span class="p">(</span><span class="mi">1</span><span class="p">);</span> <span class="n">s</span><span class="p">.</span><span class="nf">string</span><span class="p">.</span><span class="nf">valid_encoding?</span><span class="p">;</span> <span class="n">s</span><span class="p">.</span><span class="nf">truncate</span><span class="p">(</span><span class="mi">2</span><span class="p">);</span> <span class="n">s</span><span class="p">.</span><span class="nf">string</span><span class="p">.</span><span class="nf">valid_encoding?</span>
<span class="c1">#=> false (expect to be true)</span>
</code></pre> Ruby master - Bug #20186 (Open): Ripper does not generate AST for some keywords in Ruby 3.3https://bugs.ruby-lang.org/issues/201862024-01-16T06:39:52Zkzkn (Kazuki Nishikawa)
<p>Ripper does not generate AST for the below keyword:</p>
<ul>
<li>break</li>
<li>next</li>
<li>redo</li>
<li>retry</li>
<li>yield</li>
</ul>
<p>Ruby 3.2</p>
<pre><code>$ ruby -v
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-linux]
$ ruby -rripper -e "p Ripper.sexp('break')"
[:program, [[:break, []]]]
$ ruby -rripper -e "p Ripper.sexp('next')"
[:program, [[:next, []]]]
$ ruby -rripper -e "p Ripper.sexp('redo')"
[:program, [[:redo]]]
$ ruby -rripper -e "p Ripper.sexp('retry')"
[:program, [[:retry]]]
$ ruby -rripper -e "p Ripper.sexp('yield')"
[:program, [[:yield0]]]
</code></pre>
<p>Ruby 3.3</p>
<pre><code>$ ruby -v
ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [x86_64-linux]
$ ruby -rripper -e "p Ripper.sexp('break')"
nil
$ ruby -rripper -e "p Ripper.sexp('next')"
nil
$ ruby -rripper -e "p Ripper.sexp('redo')"
nil
$ ruby -rripper -e "p Ripper.sexp('retry')"
nil
$ ruby -rripper -e "p Ripper.sexp('yield')"
nil
</code></pre>
<p>EDIT)<br>
Here is a case of real-world problem: <a href="https://github.com/ruby-formatter/rufo/issues/319" class="external">https://github.com/ruby-formatter/rufo/issues/319</a></p> Ruby master - Bug #20179 (Open): `--with-ruby-version` configure option is not correctly applied ...https://bugs.ruby-lang.org/issues/201792024-01-12T13:18:55Zvo.x (Vit Ondruch)v.ondruch@tiscali.cz
<p>I am trying to configure ruby using <code>--with-ruby-version=ruby3.3</code>. Here is the configure output:</p>
<pre><code>$ /builddir/build/BUILD/ruby-3.3.0/configure --build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu --program-prefix= --disable-dependency-tracking --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib64 --libexecdir=/usr/libexec --localstatedir=/var --runstatedir=/run --sharedstatedir=/var/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-compress-debug-sections=no --disable-rpath --enable-mkmf-verbose --enable-shared --with-ruby-version=ruby3.3 --enable-yjit
... snip ...
---
Configuration summary for ruby version 3.3.0
* Installation prefix: /usr
* exec prefix: /usr
* arch: x86_64-linux
* site arch: ${arch}
* RUBY_BASE_NAME: ruby
* enable shared: yes
* ruby lib prefix: ${libdir}/${RUBY_BASE_NAME}
* site libraries path: ${rubylibprefix}/${sitearch}
* vendor path: ${rubylibprefix}/vendor_ruby
* target OS: linux
* compiler: gcc
* with thread: pthread
* with coroutine: amd64
* enable shared libs: yes
* dynamic library ext: so
* CFLAGS: ${optflags} ${debugflags} ${warnflags}
* LDFLAGS: -L. -Wl,-z,relro -Wl,--as-needed \
-Wl,-z,pack-relative-relocs -Wl,-z,now \
-specs=/usr/lib/rpm/redhat/redhat-hardened-ld \
-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 \
-Wl,--build-id=sha1 -fstack-protector-strong \
-rdynamic -Wl,-export-dynamic -Wl,--no-as-needed
* DLDFLAGS: -Wl,-z,relro -Wl,--as-needed \
-Wl,-z,pack-relative-relocs -Wl,-z,now \
-specs=/usr/lib/rpm/redhat/redhat-hardened-ld \
-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 \
-Wl,--build-id=sha1
* optflags: -O3 -fno-fast-math
* debugflags: -ggdb3
* warnflags: -Wall -Wextra -Wdeprecated-declarations \
-Wdiv-by-zero -Wduplicated-cond \
-Wimplicit-function-declaration -Wimplicit-int \
-Wpointer-arith -Wwrite-strings \
-Wold-style-definition -Wimplicit-fallthrough=0 \
-Wmissing-noreturn -Wno-cast-function-type \
-Wno-constant-logical-operand -Wno-long-long \
-Wno-missing-field-initializers \
-Wno-overlength-strings \
-Wno-packed-bitfield-compat \
-Wno-parentheses-equality -Wno-self-assign \
-Wno-tautological-compare -Wno-unused-parameter \
-Wno-unused-value -Wsuggest-attribute=format \
-Wsuggest-attribute=noreturn -Wunused-variable \
-Wmisleading-indentation -Wundef
* strip command: strip -S -x
* install doc: rdoc
* YJIT support: yes
* RJIT support: yes
* man page type: doc
---
</code></pre>
<p>However, the option is not applied consistently, especially the <code>rubyhdrdir</code> stands out:</p>
<pre><code>$ find . -name \*ruby3.3\*
./usr/lib64/ruby/ruby3.3
./usr/lib64/ruby/site_ruby/ruby3.3
./usr/lib64/ruby/vendor_ruby/ruby3.3
./usr/lib64/ruby/gems/ruby3.3
./usr/lib64/ruby/gems/ruby3.3/extensions/x86_64-linux/ruby3.3
./usr/include/ruby-ruby3.3
./usr/share/ri/ruby3.3
</code></pre>
<p>The correct path should be IMHO <code>./usr/include/ruby3.3</code>. I can likely workaround it by <code>--with-rubyhdrdir</code>, but I think this should behave consistently.</p> Ruby master - Bug #20171 (Open): ri -i ruby interactive pressing tab does not autocompletehttps://bugs.ruby-lang.org/issues/201712024-01-09T17:45:34ZMystorium (Josh Goldfarb)
<p>When typing a Object or Object with a method, the tab button does not pull up autocomplete options.</p>
<p>This issue is not present in ruby 3.2.2</p>
<p>Ex</p>
<p>Type</p>
<ul>
<li>
<p>ri - i</p>
</li>
<li>
<p>String.cap</p>
</li>
</ul>
<p>Press.</p>
<ul>
<li>"Tab"</li>
</ul>
<p>What is expected</p>
<ul>
<li>autocomplete options to populate</li>
</ul>
<p>What is happening</p>
<ul>
<li>Nothing Happens when pressing tab.</li>
</ul> Ruby master - Bug #20168 (Open): Process won't exit when Ractor.select waiting a Ractorhttps://bugs.ruby-lang.org/issues/201682024-01-09T09:29:43Zshia (Sangyong Sim)
<a name="Reproduction-code"></a>
<h2 >Reproduction code<a href="#Reproduction-code" class="wiki-anchor">¶</a></h2>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="nb">trap</span><span class="p">(</span><span class="ss">:INT</span><span class="p">)</span> <span class="k">do</span>
<span class="nb">puts</span> <span class="s2">"SIGINT"</span>
<span class="nb">exit</span>
<span class="k">end</span>
<span class="nb">trap</span><span class="p">(</span><span class="ss">:TERM</span><span class="p">)</span> <span class="k">do</span>
<span class="nb">puts</span> <span class="s2">"SIGTERM"</span>
<span class="nb">exit</span>
<span class="k">end</span>
<span class="n">r</span> <span class="o">=</span> <span class="no">Ractor</span><span class="p">.</span><span class="nf">new</span> <span class="k">do</span>
<span class="kp">loop</span> <span class="k">do</span>
<span class="nb">sleep</span> <span class="mi">1</span>
<span class="k">end</span>
<span class="k">end</span>
<span class="no">Ractor</span><span class="p">.</span><span class="nf">select</span><span class="p">(</span><span class="n">r</span><span class="p">)</span> <span class="c1"># stucked.</span>
<span class="c1"># SIGINT/SIGTERM sent to Ruby process(confirmed by trap),</span>
<span class="c1"># but process won't exit.</span>
</code></pre>
<a name="Expected-behavior"></a>
<h2 >Expected behavior<a href="#Expected-behavior" class="wiki-anchor">¶</a></h2>
<p>Process killed successfully with exit code 0.</p>
<a name="Affected-Ruby-version"></a>
<h2 >Affected Ruby version<a href="#Affected-Ruby-version" class="wiki-anchor">¶</a></h2>
<p>3.3.0<br>
3.2.x works as expected.</p> Ruby master - Bug #20165 (Open): Ractors moving a Struct breaks beyond the first 3 fieldshttps://bugs.ruby-lang.org/issues/201652024-01-08T21:02:19Zcodekitchen (Brian Palmer)
<p>Experimenting with Ractors on ruby 3.3.0, and I'm seeing a bug where if you move a struct between ractors, all but the first 3 fields are set to nil.</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="no">Foo</span> <span class="o">=</span> <span class="no">Struct</span><span class="p">.</span><span class="nf">new</span><span class="p">(</span><span class="ss">:a</span><span class="p">,</span><span class="ss">:b</span><span class="p">,</span><span class="ss">:c</span><span class="p">,</span><span class="ss">:d</span><span class="p">,</span><span class="ss">:e</span><span class="p">,</span><span class="ss">:f</span><span class="p">)</span>
<span class="n">r</span> <span class="o">=</span> <span class="no">Ractor</span><span class="p">.</span><span class="nf">new</span> <span class="p">{</span>
<span class="n">foo</span> <span class="o">=</span> <span class="no">Foo</span><span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">]</span>
<span class="nb">p</span> <span class="n">foo</span>
<span class="no">Ractor</span><span class="p">.</span><span class="nf">yield</span><span class="p">(</span><span class="n">foo</span><span class="p">,</span> <span class="ss">move: </span><span class="kp">true</span><span class="p">)</span>
<span class="p">}</span>
<span class="nb">p</span> <span class="n">r</span><span class="p">.</span><span class="nf">take</span>
</code></pre>
<pre><code>❯ ruby -v
ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [arm64-darwin23]
❯ ruby rbug.rb
rbug.rb:3: warning: Ractor is experimental, and the behavior may change in future versions of Ruby! Also there are many implementation issues.
#<struct Foo a=0, b=0, c=0, d=0, e=0, f=0>
#<struct Foo a=0, b=0, c=0, d=nil, e=nil, f=nil>
</code></pre>
<p>This seems specific to moving, if I set <code>move: false</code> the struct makes it across OK.</p> Ruby master - Bug #20103 (Open): rb_internal_thread_remove_event_hook() hangs when called from wi...https://bugs.ruby-lang.org/issues/201032023-12-28T15:46:51Zosyoyu (Daisuke Aritomo)
<a name="Problem"></a>
<h2 >Problem<a href="#Problem" class="wiki-anchor">¶</a></h2>
<p>The Ruby process hangs when <code>rb_internal_thread_remove_event_hook()</code> is called from within a Thread hook registered by <code>rb_internal_thread_add_event_hook()</code>.<br>
The thread is waiting for the thread event execution lock (<code>pthread_rwlock_wrlock(&rb_internal_thread_event_hooks_rw_lock))</code>), which is acquired by its caller, <code>rb_thread_execute_hooks()</code>.<br>
<a href="https://github.com/ruby/ruby/blob/e81a5453e3c76c4348da042d86debde7689254fe/thread_pthread.c#L3323" class="external">https://github.com/ruby/ruby/blob/e81a5453e3c76c4348da042d86debde7689254fe/thread_pthread.c#L3323</a></p>
<p>This situation would occur when one wants to register a <em>oneshot</em> hook that performs something on a Thread for only a single time. The hook would remove itself after its main procedure.<br>
In my case, I'm doing a timer_create(3) on each pthread for profiling purposes.</p>
<a name="Expected-behavior"></a>
<h2 >Expected behavior<a href="#Expected-behavior" class="wiki-anchor">¶</a></h2>
<p>The process won't hang, or at least print some kind of warning.</p>
<p>I think there some options here:</p>
<ol>
<li>Discourage this kind of definition. Thread hooks should not add/remove other Thread hooks, or otherwise do so through other async methods, such as postponed jobs.</li>
<li>Find a way to make this work. Maybe inner calls to add/remove_event_hook() can share locks with the outer call, but I'm not sure if that's possible as I'm not familiar with pthread_rwlocks.</li>
</ol>
<a name="Repro"></a>
<h2 >Repro<a href="#Repro" class="wiki-anchor">¶</a></h2>
<pre><code class="c syntaxhl" data-language="c"><span class="cp">#include</span> <span class="cpf">"ruby.h"</span><span class="cp">
#include</span> <span class="cpf">"ruby/thread.h"</span><span class="cp">
</span>
<span class="n">rb_internal_thread_event_hook_t</span> <span class="o">*</span><span class="n">hook</span><span class="p">;</span>
<span class="kt">void</span>
<span class="nf">event_hook_callback</span><span class="p">(</span><span class="n">rb_event_flag_t</span> <span class="n">flag</span><span class="p">,</span> <span class="k">const</span> <span class="n">rb_internal_thread_event_data_t</span> <span class="o">*</span><span class="n">data</span><span class="p">,</span> <span class="kt">void</span> <span class="o">*</span><span class="n">custom_data</span><span class="p">)</span>
<span class="p">{</span>
<span class="n">rb_internal_thread_remove_event_hook</span><span class="p">(</span><span class="n">hook</span><span class="p">);</span> <span class="c1">// hangs</span>
<span class="p">}</span>
<span class="n">RUBY_FUNC_EXPORTED</span> <span class="kt">void</span>
<span class="nf">Init_mycext</span><span class="p">(</span><span class="kt">void</span><span class="p">)</span>
<span class="p">{</span>
<span class="n">hook</span> <span class="o">=</span> <span class="n">rb_internal_thread_add_event_hook</span><span class="p">(</span>
<span class="n">event_hook_callback</span><span class="p">,</span>
<span class="n">RUBY_INTERNAL_THREAD_EVENT_RESUMED</span><span class="p">,</span>
<span class="nb">NULL</span>
<span class="p">);</span>
<span class="p">}</span>
</code></pre>
<pre><code>ruby -rmycext -e 'Thread.new { loop { 1 + 1 } }'
</code></pre> Ruby master - Bug #20099 (Open): Ruby 3.3.0 segfaults on s390x musl libc (Alpine Linux) when buil...https://bugs.ruby-lang.org/issues/200992023-12-27T16:27:54Zjirutka (Jakub Jirutka)jakub@jirutka.cz
<p>It does not segfault when I override <code>optflags</code> to <code>-O2</code> (default is <code>-O3</code>).</p>
<pre><code>Configuration summary for ruby version 3.3.0
* Installation prefix: /usr
* exec prefix: ${prefix}
* arch: s390x-linux-musl
* site arch: ${arch}
* RUBY_BASE_NAME: ruby
* enable shared: yes
* ruby lib prefix: ${libdir}/${RUBY_BASE_NAME}
* site libraries path: ${rubylibprefix}/${sitearch}
* vendor path: ${rubylibprefix}/vendor_ruby
* target OS: linux-musl
* compiler: gcc
* with thread: pthread
* with coroutine: ucontext
* enable shared libs: yes
* dynamic library ext: so
* CFLAGS: ${optflags} ${debugflags} ${warnflags}
* LDFLAGS: -L. -Wl,--as-needed,-O1,--sort-common \
-fstack-protector-strong -rdynamic \
-Wl,-export-dynamic -Wl,--no-as-needed
* DLDFLAGS: -Wl,--as-needed,-O1,--sort-common \
-Wl,--compress-debug-sections=zlib
* optflags: -O3 -fno-fast-math
* debugflags: -ggdb3
* warnflags: -Wall -Wextra -Wdeprecated-declarations \
-Wdiv-by-zero -Wduplicated-cond \
-Wimplicit-function-declaration -Wimplicit-int \
-Wpointer-arith -Wwrite-strings \
-Wold-style-definition -Wimplicit-fallthrough=0 \
-Wmissing-noreturn -Wno-cast-function-type \
-Wno-constant-logical-operand -Wno-long-long \
-Wno-missing-field-initializers \
-Wno-overlength-strings \
-Wno-packed-bitfield-compat \
-Wno-parentheses-equality -Wno-self-assign \
-Wno-tautological-compare -Wno-unused-parameter \
-Wno-unused-value -Wsuggest-attribute=format \
-Wsuggest-attribute=noreturn -Wunused-variable \
-Wmisleading-indentation -Wundef
* strip command: strip -S -x
* install doc: rdoc
* YJIT support: no
* RJIT support: no
* man page type: man
* search path: /usr/lib/site_ruby/$(ruby_ver)/s390x-linux
---
BASERUBY = ./tool/missing-baseruby.bat
CC = gcc
LD = ld
LDSHARED = gcc -shared
CFLAGS = -O2 -fstack-clash-protection -Wformat -Werror=format-security -g -fno-omit-frame-pointer -fno-strict-aliasing -fPIC
XCFLAGS = -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fno-strict-overflow -fvisibility=hidden -fexcess-precision=standard -DRUBY_EXPORT -I. -I.ext/include/s390x-linux-musl -I./include -I. -I./prism -I./enc/unicode/15.0.0
CPPFLAGS = -fno-omit-frame-pointer -fno-strict-aliasing
DLDFLAGS = -Wl,--as-needed,-O1,--sort-common -Wl,--compress-debug-sections=zlib -Wl,-soname,libruby.so.3.3 -fstack-protector-strong
SOLIBS = -lz -lrt -lrt -lgmp -ldl -lcrypt -lm -lpthread -lucontext
LANG =
LC_ALL =
LC_CTYPE =
MFLAGS = -j8 --jobserver-auth=fifo:/tmp/GMfifo7323
RUSTC = no
YJIT_RUSTC_ARGS = --crate-name=yjit --crate-type=staticlib --edition=2021 -g -C lto=thin -C opt-level=3 -C overflow-checks=on '--out-dir=/builds/alpine/aports/main/ruby/src/ruby-3.3.0/yjit/target/release/' ./yjit/src/lib.rs
</code></pre>
<pre><code>2023-12-26 20:45:17 +0000
Driver is ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [s390x-linux-musl]
Target is ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [s390x-linux-musl]
..............................................................................
..............................................................................
..............................................................................
..............................................................................
................................................................EA core file is found. Saving it at: "/tmp/bootstraptest-core.2023-12-26T20:45:18Z"
["gdb", "/builds/alpine/aports/main/ruby/src/ruby-3.3.0/ruby -I/builds/alpine/aports/main/ruby/src/ruby-3.3.0/lib --disable-gems", "-c", "/tmp/bootstraptest-core.2023-12-26T20:45:18Z", "-ex", "bt", "-batch"]
...EA core file is found. Saving it at: "/tmp/bootstraptest-core.2023-12-26T20:45:19Z"
["gdb", "/builds/alpine/aports/main/ruby/src/ruby-3.3.0/ruby -I/builds/alpine/aports/main/ruby/src/ruby-3.3.0/lib --disable-gems", "-c", "/tmp/bootstraptest-core.2023-12-26T20:45:19Z", "-ex", "bt", "-batch"]
.....Fstderr output is not empty
[BUG] Segmentation fault at 0x000007fece67a000
ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [s390x-linux-musl]
-- Control frame information -----------------------------------------------
c:0001 p:---- s:0003 e:000002 DUMMY [FINISH]
-- Threading information ---------------------------------------------------
Total ractor count: 2
Ruby thread count for this ractor: 1
-- Other runtime information -----------------------------------------------
* Loaded script: bootstraptest.test_ractor.rb_244_1238.rb
* Loaded features:
0 enumerator.so
1 thread.rb
2 fiber.so
3 rational.so
4 complex.so
5 ruby2_keywords.rb
6 /builds/alpine/aports/main/ruby/src/ruby-3.3.0/.ext/s390x-linux-musl/enc/encdb.so
7 /builds/alpine/aports/main/ruby/src/ruby-3.3.0/.ext/s390x-linux-musl/enc/trans/transdb.so
* Process memory map:
2aa25e00000-2aa25e01000 r-xp 00000000 fe:00 2520910 /builds/alpine/aports/main/ruby/src/ruby-3.3.0/ruby
2aa25e01000-2aa25e02000 r--p 00000000 fe:00 2520910 /builds/alpine/aports/main/ruby/src/ruby-3.3.0/ruby
2aa25e02000-2aa25e03000 rw-p 00001000 fe:00 2520910 /builds/alpine/aports/main/ruby/src/ruby-3.3.0/ruby
2aa2765d000-2aa2765e000 ---p 00000000 00:00 0 [heap]
2aa2765e000-2aa27664000 rw-p 00000000 00:00 0 [heap]
3ff572a8000-3ff572aa000 ---p 00000000 00:00 0
3ff572aa000-3ff572d0000 rw-p 00000000 00:00 0
3ff572d0000-3ff572d2000 ---p 00000000 00:00 0
3ff572d2000-3ff573f9000 rw-p 00000000 00:00 0
3ff573f9000-3ff573fa000 ---p 00000000 00:00 0
3ff573fa000-3ff5751a000 rw-p 00000000 00:00 0
3ff5751a000-3ff5751b000 ---p 00000000 00:00 0
3ff5751b000-3ff77300000 rw-p 00000000 00:00 0
3ff77300000-3ff77302000 r-xp 00000000 fe:00 2520334 /builds/alpine/aports/main/ruby/src/ruby-3.3.0/.ext/s390x-linux-musl/enc/trans/transdb.so
3ff77302000-3ff77303000 r--p 00002000 fe:00 2520334 /builds/alpine/aports/main/ruby/src/ruby-3.3.0/.ext/s390x-linux-musl/enc/trans/transdb.so
3ff77303000-3ff77304000 rw-p 00003000 fe:00 2520334 /builds/alpine/aports/main/ruby/src/ruby-3.3.0/.ext/s390x-linux-musl/enc/trans/transdb.so
3ff77307000-3ff77309000 rw-p 00000000 00:00 0
3ff7730b000-3ff7730e000 rw-p 00000000 00:00 0
3ff77310000-3ff77330000 rw-p 00000000 00:00 0
3ff77332000-3ff77337000 rw-p 00000000 00:00 0
3ff77339000-3ff7733a000 rw-p 00000000 00:00 0
3ff7733b000-3ff7733e000 rw-p 00000000 00:00 0
3ff77340000-3ff77380000 rw-p 00000000 00:00 0
3ff77380000-3ff77382000 r-xp 00000000 fe:00 2520245 /builds/alpine/aports/main/ruby/src/ruby-3.3.0/.ext/s390x-linux-musl/enc/encdb.so
3ff77382000-3ff77383000 r--p 00001000 fe:00 2520245 /builds/alpine/aports/main/ruby/src/ruby-3.3.0/.ext/s390x-linux-musl/enc/encdb.so
3ff77383000-3ff77384000 rw-p 00002000 fe:00 2520245 /builds/alpine/aports/main/ruby/src/ruby-3.3.0/.ext/s390x-linux-musl/enc/encdb.so
3ff77384000-3ff7739c000 rw-p 00000000 00:00 0
3ff7739c000-3ff7739d000 ---p 00000000 00:00 0
3ff7739d000-3ff773de000 rw-p 00000000 00:00 0
3ff773de000-3ff773df000 ---p 00000000 00:00 0
3ff773df000-3ff77420000 rw-p 00000000 00:00 0
3ff77420000-3ff77421000 ---p 00000000 00:00 0
3ff77421000-3ff77462000 rw-p 00000000 00:00 0
3ff77462000-3ff77463000 ---p 00000000 00:00 0
3ff77463000-3ff774a4000 rw-p 00000000 00:00 0
3ff774a4000-3ff774a5000 ---p 00000000 00:00 0
3ff774a5000-3ff774e6000 rw-p 00000000 00:00 0
3ff774e6000-3ff774e7000 ---p 00000000 00:00 0
3ff774e7000-3ff77528000 rw-p 00000000 00:00 0
3ff77528000-3ff77529000 ---p 00000000 00:00 0
3ff77529000-3ff7756a000 rw-p 00000000 00:00 0
3ff7756a000-3ff7756b000 ---p 00000000 00:00 0
3ff7756b000-3ff775ac000 rw-p 00000000 00:00 0
3ff775ac000-3ff775ad000 ---p 00000000 00:00 0
3ff775ad000-3ff775ee000 rw-p 00000000 00:00 0
3ff775ee000-3ff775ef000 ---p 00000000 00:00 0
3ff775ef000-3ff77630000 rw-p 00000000 00:00 0
3ff77630000-3ff77631000 ---p 00000000 00:00 0
3ff77631000-3ff77672000 rw-p 00000000 00:00 0
3ff77672000-3ff77673000 ---p 00000000 00:00 0
3ff77673000-3ff776b4000 rw-p 00000000 00:00 0
3ff776b4000-3ff776b5000 ---p 00000000 00:00 0
3ff776b5000-3ff776f6000 rw-p 00000000 00:00 0
3ff776f6000-3ff776f7000 ---p 00000000 00:00 0
3ff776f7000-3ff77738000 rw-p 00000000 00:00 0
3ff77738000-3ff77739000 ---p 00000000 00:00 0
3ff77739000-3ff7777a000 rw-p 00000000 00:00 0
3ff7777a000-3ff7777b000 ---p 00000000 00:00 0
3ff7777b000-3ff777bc000 rw-p 00000000 00:00 0
3ff777bc000-3ff777bd000 ---p 00000000 00:00 0
3ff777bd000-3ff777fe000 rw-p 00000000 00:00 0
3ff777fe000-3ff777ff000 ---p 00000000 00:00 0
3ff777ff000-3ff77840000 rw-p 00000000 00:00 0
3ff77840000-3ff77841000 ---p 00000000 00:00 0
3ff77841000-3ff77882000 rw-p 00000000 00:00 0
3ff77882000-3ff77883000 ---p 00000000 00:00 0
3ff77883000-3ff778c4000 rw-p 00000000 00:00 0
3ff778c4000-3ff778c5000 ---p 00000000 00:00 0
3ff778c5000-3ff77906000 rw-p 00000000 00:00 0
3ff77906000-3ff77907000 ---p 00000000 00:00 0
3ff77907000-3ff77948000 rw-p 00000000 00:00 0
3ff77948000-3ff77949000 ---p 00000000 00:00 0
3ff77949000-3ff7798a000 rw-p 00000000 00:00 0
3ff7798a000-3ff7798b000 ---p 00000000 00:00 0
3ff7798b000-3ff779cc000 rw-p 00000000 00:00 0
3ff779cc000-3ff779cd000 ---p 00000000 00:00 0
3ff779cd000-3ff77a0e000 rw-p 00000000 00:00 0
3ff77a0e000-3ff77a0f000 ---p 00000000 00:00 0
3ff77a0f000-3ff77a50000 rw-p 00000000 00:00 0
3ff77a50000-3ff77a51000 ---p 00000000 00:00 0
3ff77a51000-3ff77a92000 rw-p 00000000 00:00 0
3ff77a92000-3ff77a93000 ---p 00000000 00:00 0
3ff77a93000-3ff77ad4000 rw-p 00000000 00:00 0
3ff77ad4000-3ff77ad5000 ---p 00000000 00:00 0
3ff77ad5000-3ff77b16000 rw-p 00000000 00:00 0
3ff77b16000-3ff77b17000 ---p 00000000 00:00 0
3ff77b17000-3ff77b58000 rw-p 00000000 00:00 0
3ff77b58000-3ff77b59000 ---p 00000000 00:00 0
3ff77b59000-3ff77b9a000 rw-p 00000000 00:00 0
3ff77b9a000-3ff77b9b000 ---p 00000000 00:00 0
3ff77b9b000-3ff77bdc000 rw-p 00000000 00:00 0
3ff77bdc000-3ff77bde000 ---p 00000000 00:00 0
3ff77bde000-3ff91100000 rw-p 00000000 00:00 0
3ff91100000-3ff91101000 r-xp 00000000 fe:00 2758431 /lib/libucontext.so.1
3ff91101000-3ff91102000 r--p 00000000 fe:00 2758431 /lib/libucontext.so.1
3ff91102000-3ff91103000 rw-p 00001000 fe:00 2758431 /lib/libucontext.so.1
3ff91103000-3ff9114b000 rw-p 00000000 00:00 0
3ff9114f000-3ff91153000 rw-p 00000000 00:00 0
3ff91155000-3ff91180000 rw-p 00000000 00:00 0
3ff91180000-3ff911fd000 r-xp 00000000 fe:00 2755903 /usr/lib/libgmp.so.10.5.0
3ff911fd000-3ff911ff000 r--p 0007c000 fe:00 2755903 /usr/lib/libgmp.so.10.5.0
3ff911ff000-3ff91200000 rw-p 0007e000 fe:00 2755903 /usr/lib/libgmp.so.10.5.0
3ff91200000-3ff91219000 r-xp 00000000 fe:00 2754145 /lib/libz.so.1.3
3ff91219000-3ff9121a000 r--p 00018000 fe:00 2754145 /lib/libz.so.1.3
3ff9121a000-3ff9121b000 rw-p 00019000 fe:00 2754145 /lib/libz.so.1.3
3ff9121b000-3ff91280000 rw-p 00000000 00:00 0
3ff91280000-3ff91700000 r-xp 00000000 fe:00 2519847 /builds/alpine/aports/main/ruby/src/ruby-3.3.0/libruby.so.3.3.0
3ff91700000-3ff9170c000 r--p 00480000 fe:00 2519847 /builds/alpine/aports/main/ruby/src/ruby-3.3.0/libruby.so.3.3.0
3ff9170c000-3ff9170d000 rw-p 0048c000 fe:00 2519847 /builds/alpine/aports/main/ruby/src/ruby-3.3.0/libruby.so.3.3.0
3ff9170d000-3ff9171f000 rw-p 00000000 00:00 0
3ff9171f000-3ff91780000 rw-p 00000000 00:00 0
3ff91780000-3ff91830000 r-xp 00000000 fe:00 2758095 /lib/ld-musl-s390x.so.1
3ff91830000-3ff91831000 r--p 000b0000 fe:00 2758095 /lib/ld-musl-s390x.so.1
3ff91831000-3ff91832000 rw-p 000b1000 fe:00 2758095 /lib/ld-musl-s390x.so.1
3ff91832000-3ff91835000 rw-p 00000000 00:00 0
3ff91835000-3ff9187c000 rw-p 00000000 00:00 0
3ff9187c000-3ff9187e000 r--p 00000000 00:00 0 [vvar]
3ff9187e000-3ff91880000 r-xp 00000000 00:00 0 [vdso]
3ffe2381000-3ffe2b80000 rw-p 00000000 00:00 0 [stack]
</code></pre>
<p>…and many more tests fail like this.</p>
<p>Build script: <a href="https://gitlab.alpinelinux.org/alpine/aports/-/blob/8dbcda97e3e558a5a1cded3586a198f9d16b633e/main/ruby/APKBUILD#L134" class="external">APKBUILD</a></p>
<p><strong>Environment:</strong></p>
<ul>
<li>Alpine Linux Edge</li>
<li>gcc 13.2.1_git20231014 (with many <a href="https://gitlab.alpinelinux.org/alpine/aports/-/tree/master/main/gcc" class="external">downstream patches</a>)</li>
</ul> Ruby master - Bug #20098 (Open): Wrong regexp match in ruby 3.2 and 3.3https://bugs.ruby-lang.org/issues/200982023-12-27T12:15:54Ztompng (tomoya ishida)tomoyapenguin@gmail.com
<p>These regexp all matches in ruby 3.1.4, but not in ruby 3.3.0.</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="nb">p</span> <span class="sr">/a((.|.)|bc){,4}z/</span><span class="p">.</span><span class="nf">match?</span> <span class="s1">'abcbcbcbcz'</span>
<span class="nb">p</span> <span class="sr">/a(b+?c*){4,5}z/</span><span class="p">.</span><span class="nf">match?</span> <span class="s1">'abbbccbbbccbcbcz'</span> <span class="c1"># matches in ruby 3.2.2</span>
<span class="nb">p</span> <span class="sr">/a(b+?(.|.)){2,3}z/</span><span class="p">.</span><span class="nf">match?</span> <span class="s1">'abbbcbbbcbbbcz'</span>
<span class="nb">p</span> <span class="sr">/a(b*?(.|.)[bc]){2,5}z/</span><span class="p">.</span><span class="nf">match?</span> <span class="s1">'abcbbbcbcccbcz'</span>
</code></pre>
<p>Adding backref (to disable optimization) makes them match.</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="nb">p</span> <span class="sr">/()\1a((.|.)|bc){,4}z/</span><span class="p">.</span><span class="nf">match?</span> <span class="s1">'abcbcbcbcz'</span>
<span class="nb">p</span> <span class="sr">/()\1a(b+?c*){4,5}z/</span><span class="p">.</span><span class="nf">match?</span> <span class="s1">'abbbccbbbccbcbcz'</span>
<span class="nb">p</span> <span class="sr">/()\1a(b+?(.|.)){2,3}z/</span><span class="p">.</span><span class="nf">match?</span> <span class="s1">'abbbcbbbcbbbcz'</span>
<span class="nb">p</span> <span class="sr">/()\1a(b*?(.|.)[bc]){2,5}z/</span><span class="p">.</span><span class="nf">match?</span> <span class="s1">'abcbbbcbcccbcz'</span>
</code></pre>
<p>Found in this script <a href="https://gist.github.com/tompng/aa0706a181e9187bd79e8cec5a5f3c97" class="external">https://gist.github.com/tompng/aa0706a181e9187bd79e8cec5a5f3c97</a></p> Ruby master - Bug #20097 (Open): Regexp#match? with empty capture group repeat is inconsistenthttps://bugs.ruby-lang.org/issues/200972023-12-27T10:56:46Ztompng (tomoya ishida)tomoyapenguin@gmail.com
<p>It sometimes matches and sometimes does not, depend on repeat quantifier number.</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="c1"># empty capture group repeat</span>
<span class="nb">p</span> <span class="sr">/(a(){1,4}){2}/</span><span class="p">.</span><span class="nf">match?</span><span class="p">(</span><span class="s1">'aa'</span><span class="p">)</span> <span class="c1">#=> true</span>
<span class="nb">p</span> <span class="sr">/(a(){1,5}){2}/</span><span class="p">.</span><span class="nf">match?</span><span class="p">(</span><span class="s1">'aa'</span><span class="p">)</span> <span class="c1">#=> false</span>
<span class="c1"># repeat of capture group that match to empty string</span>
<span class="nb">p</span> <span class="sr">/(a(|){1,2}){2}/</span><span class="p">.</span><span class="nf">match?</span><span class="p">(</span><span class="s1">'aa'</span><span class="p">)</span> <span class="c1">#=> true</span>
<span class="nb">p</span> <span class="sr">/(a(|){1,3}){2}/</span><span class="p">.</span><span class="nf">match?</span><span class="p">(</span><span class="s1">'aa'</span><span class="p">)</span> <span class="c1">#=> false</span>
<span class="nb">p</span> <span class="sr">/(a(x?y?|z){1,2}){2}/</span><span class="p">.</span><span class="nf">match?</span><span class="p">(</span><span class="s1">'aa'</span><span class="p">)</span> <span class="c1">#=> false</span>
</code></pre>
<p>non-capturing group seems ok.</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="nb">p</span> <span class="sr">/(a(?:){1,4}){2}/</span><span class="p">.</span><span class="nf">match?</span><span class="p">(</span><span class="s1">'aa'</span><span class="p">)</span> <span class="c1">#=> true</span>
<span class="nb">p</span> <span class="sr">/(a(?:){1,5}){2}/</span><span class="p">.</span><span class="nf">match?</span><span class="p">(</span><span class="s1">'aa'</span><span class="p">)</span> <span class="c1">#=> true</span>
<span class="nb">p</span> <span class="sr">/(a(?:|){1,2}){2}/</span><span class="p">.</span><span class="nf">match?</span><span class="p">(</span><span class="s1">'aa'</span><span class="p">)</span> <span class="c1">#=> true</span>
<span class="nb">p</span> <span class="sr">/(a(?:|){1,3}){2}/</span><span class="p">.</span><span class="nf">match?</span><span class="p">(</span><span class="s1">'aa'</span><span class="p">)</span> <span class="c1">#=> true</span>
<span class="nb">p</span> <span class="sr">/(a(?:x?y?|z){1,2}){2}/</span><span class="p">.</span><span class="nf">match?</span><span class="p">(</span><span class="s1">'aa'</span><span class="p">)</span> <span class="c1">#=> true</span>
</code></pre>
<p>Same behavior in ruby 3.0, 3.1, 3.2</p> Ruby master - Bug #20088 (Open): Ruby 3.3.0 does not cross-complie on arm64-darwinhttps://bugs.ruby-lang.org/issues/200882023-12-26T15:33:49Zstanhu (Stan Hu)
<p>To reproduce:</p>
<pre><code class="shell syntaxhl" data-language="shell">docker run <span class="nt">-it</span> ghcr.io/rake-compiler/rake-compiler-dock-image:1.4.0.rc2-mri-arm64-darwin bash
<span class="nb">cd</span> /tmp
<span class="nb">export </span><span class="nv">CPPFLAGS</span><span class="o">=</span><span class="s1">''</span>
<span class="nb">export </span><span class="nv">CFLAGS</span><span class="o">=</span><span class="s1">'-O1 -fno-omit-frame-pointer -fno-fast-math -fstack-protector-strong '</span>
<span class="nb">export </span><span class="nv">LDFLAGS</span><span class="o">=</span><span class="s1">'-pipe '</span>
<span class="nb">export </span><span class="nv">CC</span><span class="o">=</span>aarch64-apple-darwin-clang
<span class="nb">export </span><span class="nv">MAKE</span><span class="o">=</span><span class="s1">'make V=1'</span>
rake-compiler cross-ruby <span class="nv">VERSION</span><span class="o">=</span>3.3.0 <span class="nv">HOST</span><span class="o">=</span>aarch64-apple-darwin
</code></pre>
<p>This errors out with:</p>
<pre><code class="shell syntaxhl" data-language="shell">aarch64-apple-darwin-clang <span class="nt">-O1</span> <span class="nt">-fno-omit-frame-pointer</span> <span class="nt">-fno-fast-math</span> <span class="nt">-fstack-protector-strong</span> <span class="nt">-fdeclspec</span> <span class="nt">-O3</span> <span class="nt">-fno-fast-math</span> <span class="nt">-ggdb3</span> <span class="nt">-Wall</span> <span class="nt">-Wextra</span> <span class="nt">-Wextra-tokens</span> <span class="nt">-Wdeprecated-declarations</span> <span class="nt">-Wdivision-by-zero</span> <span class="nt">-Wdiv-by-zero</span> <span class="nt">-Wimplicit-function-declaration</span> <span class="nt">-Wimplicit-int</span> <span class="nt">-Wpointer-arith</span> <span class="nt">-Wshorten-64-to-32</span> <span class="nt">-Wwrite-strings</span> <span class="nt">-Wold-style-definition</span> <span class="nt">-Wmissing-noreturn</span> <span class="nt">-Wno-constant-logical-operand</span> <span class="nt">-Wno-long-long</span> <span class="nt">-Wno-missing-field-initializers</span> <span class="nt">-Wno-overlength-strings</span> <span class="nt">-Wno-parentheses-equality</span> <span class="nt">-Wno-self-assign</span> <span class="nt">-Wno-tautological-compare</span> <span class="nt">-Wno-unused-parameter</span> <span class="nt">-Wno-unused-value</span> <span class="nt">-Wunused-variable</span> <span class="nt">-Wmisleading-indentation</span> <span class="nt">-Wundef</span> <span class="nt">-pipe</span> <span class="nt">-march</span><span class="o">=</span>arm64 <span class="nt">-U_FORTIFY_SOURCE</span> <span class="nt">-D_FORTIFY_SOURCE</span><span class="o">=</span>2 <span class="nt">-fstack-protector-strong</span> <span class="nt">-fno-strict-overflow</span> <span class="nt">-fvisibility</span><span class="o">=</span>hidden <span class="nt">-DRUBY_EXPORT</span> <span class="nt">-fPIE</span> <span class="nt">-I</span><span class="nb">.</span> <span class="nt">-I</span>.ext/include/arm64-darwin <span class="nt">-I</span>/usr/local/rake-compiler/sources/ruby-3.3.0/include <span class="nt">-I</span>/usr/local/rake-compiler/sources/ruby-3.3.0 <span class="nt">-I</span>/usr/local/rake-compiler/sources/ruby-3.3.0/prism <span class="nt">-I</span>/usr/local/rake-compiler/sources/ruby-3.3.0/enc/unicode/15.0.0 <span class="nt">-D_XOPEN_SOURCE</span> <span class="nt">-D_DARWIN_C_SOURCE</span> <span class="nt">-D_DARWIN_UNLIMITED_SELECT</span> <span class="nt">-D_REENTRANT</span> <span class="nt">-o</span> main.o <span class="nt">-c</span> /usr/local/rake-compiler/sources/ruby-3.3.0/main.c
clang: error: the clang compiler does not support <span class="s1">'-march=arm64'</span>
make: <span class="k">***</span> <span class="o">[</span>uncommon.mk:1291: main.o] Error 1
</code></pre>
<p>This appears to be a regression due to <a href="https://github.com/ruby/ruby/pull/9250" class="external">https://github.com/ruby/ruby/pull/9250</a>. <code>RUBY_DEFAULT_ARCH("$target_cpu")</code> is called, and this <code>case</code> statement is hit:</p>
<pre><code data-language="ac">AS_CASE([$build_os],
[darwin*], [ARCH_FLAG="-arch "$1],
[ARCH_FLAG=-march=$1]
</code></pre>
<p>I'm not sure this test is correct, since <code>$build_os</code> appears to be <code>linux-gnu</code>. This results in <code>-march=arm64</code> being used, which is not a valid option even in <code>clang</code> 15.0.0.</p>
<p>Should <code>$target_cpu</code> and <code>$target_os</code> be considered instead?</p>
<p>The <code>configure</code> output shows:</p>
<pre><code>Configuration summary for ruby version 3.3.0
* Installation prefix: /usr/local/rake-compiler/ruby/aarch64-apple-darwin/ruby-3.3.0
* exec prefix: ${prefix}
* arch: arm64-darwin
* site arch: ${arch}
* RUBY_BASE_NAME: ruby
* enable shared: no
* ruby lib prefix: ${libdir}/${RUBY_BASE_NAME}
* site libraries path: ${rubylibprefix}/${sitearch}
* vendor path: ${rubylibprefix}/vendor_ruby
* target OS: darwin
* compiler: aarch64-apple-darwin-clang
* with thread: pthread
* with coroutine: arm64
* enable shared libs: no
* dynamic library ext: bundle
* CFLAGS: -fdeclspec ${optflags} ${debugflags} ${warnflags}
* LDFLAGS: -L. -pipe -fstack-protector-strong
* DLDFLAGS: -pipe -Wl,-multiply_defined,suppress -Wl,-undefined,dynamic_lookup
* optflags: -O3 -fno-fast-math
* debugflags: -ggdb3
* warnflags: -Wall -Wextra -Wextra-tokens -Wdeprecated-declarations -Wdivision-by-zero -Wdiv-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition \
-Wmissing-noreturn -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter \
-Wno-unused-value -Wunused-variable -Wmisleading-indentation -Wundef
* strip command: aarch64-apple-darwin-strip -A -n
* install doc: no
* YJIT support: no
* RJIT support: no
* man page type: man
* BASERUBY -v: ruby 3.1.3p185 (2022-11-24 revision 1a6b16756e) [x86_64-linux]
</code></pre>
<p>The <code>configure</code> statement for reference:</p>
<pre><code>./configure --host=aarch64-apple-darwin --target=aarch64-apple-darwin --build=x86_64-pc-linux-gnu --enable-install-static-library --disable-jit-support --disable-install-doc --with-ext= --enable-static --disable-shared --prefix=/usr/local/rake-compiler/ruby/aarch64-apple-darwin/ruby-3.3.0
</code></pre>
<p>This was first reported in a CI failure in <a href="https://github.com/rake-compiler/rake-compiler-dock/pull/112#issuecomment-1869367367" class="external">https://github.com/rake-compiler/rake-compiler-dock/pull/112#issuecomment-1869367367</a>.</p> Ruby master - Bug #20081 (Open): Transfered Fiber doesn't return to Fiber that started ithttps://bugs.ruby-lang.org/issues/200812023-12-23T17:44:10Zrmosolgo (Robert Mosolgo)rdmosolgo@gmail.com
<p>Hi! I'm trying to figure out how to make sure that Fibers started with <code>.transfer</code> end up <em>terminated</em>, not just suspended. (If they're suspended, Rails thinks they're still alive, and they continue to hold onto database connections, see: <a href="https://github.com/rmosolgo/graphql-ruby/issues/4739#issuecomment-1866930914" class="external">https://github.com/rmosolgo/graphql-ruby/issues/4739#issuecomment-1866930914</a>.)</p>
<p>So, I'm looking for way to make sure that any Fiber I start with <code>.transfer</code> will be properly terminated. But what I noticed is that when a transfer-based Fiber terminates, it gives control back to the top-most Fiber, not the Fiber which transfered to it. Is this intended? Here's a script to replicate the issue:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="n">manager</span> <span class="o">=</span> <span class="no">Fiber</span><span class="p">.</span><span class="nf">new</span> <span class="k">do</span>
<span class="n">parent</span> <span class="o">=</span> <span class="no">Fiber</span><span class="p">.</span><span class="nf">current</span>
<span class="n">worker</span> <span class="o">=</span> <span class="no">Fiber</span><span class="p">.</span><span class="nf">new</span> <span class="k">do</span>
<span class="nb">puts</span> <span class="s2">"2. Begin Worker"</span>
<span class="n">parent</span><span class="p">.</span><span class="nf">transfer</span>
<span class="nb">puts</span> <span class="s2">"4. End Worker"</span>
<span class="k">end</span>
<span class="nb">puts</span> <span class="s2">"1. Transfer 1"</span>
<span class="n">worker</span><span class="p">.</span><span class="nf">transfer</span>
<span class="nb">puts</span> <span class="s2">"3. Transfer 2"</span>
<span class="n">worker</span><span class="p">.</span><span class="nf">transfer</span>
<span class="nb">puts</span> <span class="s2">"5. Finished manager"</span>
<span class="k">end</span>
<span class="n">manager</span><span class="p">.</span><span class="nf">transfer</span>
<span class="nb">puts</span> <span class="s2">"6. Finished script"</span>
</code></pre>
<p>I expect the steps to print in order:</p>
<pre><code>1. Transfer 1
2. Begin Worker
3. Transfer 2
4. End Worker
5. Finished manager
6. Finished script
</code></pre>
<p>But instead, <code>5. ...</code> is skipped:</p>
<pre><code>1. Transfer 1
2. Begin Worker
3. Transfer 2
4. End Worker
6. Finished script
</code></pre>
<p>I think that's because my <code>worker</code> fiber terminates and passes control back to the top-level Fiber.</p>
<p>Should it have passed control back to the <code>manager</code>? Or is there another way to make sure <code>worker</code> is terminated, and <code>manager</code> gets control?</p> Ruby master - Bug #20020 (Open): Segfault running regexp match?https://bugs.ruby-lang.org/issues/200202023-11-23T16:58:15Zandrea.salicetti@gmail.com (Andrea Salicetti)
<p><strong>Ruby version</strong> : ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-darwin23]</p>
<p>From <code>irb</code>, trying to call <code>match?</code> on this regular expression causes a segmentation falut:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="n">irb</span><span class="p">(</span><span class="n">main</span><span class="p">):</span><span class="mo">001</span><span class="p">:</span><span class="mi">0</span><span class="o">></span> <span class="sr">/^((a|c)|\s?){1,3}$/</span><span class="p">.</span><span class="nf">match?</span><span class="p">(</span><span class="s1">'abc'</span><span class="p">)</span>
<span class="o">=></span> <span class="kp">false</span>
<span class="n">irb</span><span class="p">(</span><span class="n">main</span><span class="p">):</span><span class="mo">002</span><span class="p">:</span><span class="mi">0</span><span class="o">></span> <span class="sr">/^((a|c)|\s?){1,3}$/</span><span class="p">.</span><span class="nf">match?</span><span class="p">(</span><span class="s1">'abc'</span><span class="p">)</span>
<span class="p">(</span><span class="n">irb</span><span class="p">):</span><span class="mi">2</span><span class="p">:</span> <span class="p">[</span><span class="no">BUG</span><span class="p">]</span> <span class="no">Segmentation</span> <span class="n">fault</span> <span class="n">at</span> <span class="mh">0x000000061ba998e8</span>
<span class="n">ruby</span> <span class="mf">3.2</span><span class="o">.</span><span class="mi">2</span> <span class="p">(</span><span class="mi">2023</span><span class="o">-</span><span class="mo">03</span><span class="o">-</span><span class="mi">30</span> <span class="n">revision</span> <span class="n">e51014f9c0</span><span class="p">)</span> <span class="p">[</span><span class="n">x86_64</span><span class="o">-</span><span class="n">darwin23</span><span class="p">]</span>
<span class="o">--</span> <span class="no">Crash</span> <span class="no">Report</span> <span class="n">log</span> <span class="n">information</span> <span class="o">--------------------------------------------</span>
<span class="no">See</span> <span class="no">Crash</span> <span class="no">Report</span> <span class="n">log</span> <span class="n">file</span> <span class="k">in</span> <span class="n">one</span> <span class="n">of</span> <span class="n">the</span> <span class="n">following</span> <span class="ss">locations:
</span><span class="o">*</span> <span class="o">~</span><span class="sr">/Library/</span><span class="no">Logs</span><span class="o">/</span><span class="no">DiagnosticReports</span>
<span class="o">*</span> <span class="sr">/Library/</span><span class="no">Logs</span><span class="o">/</span><span class="no">DiagnosticReports</span>
<span class="k">for</span> <span class="n">more</span> <span class="n">details</span><span class="o">.</span>
<span class="no">Don</span><span class="err">'</span><span class="n">t</span> <span class="n">forget</span> <span class="n">to</span> <span class="kp">include</span> <span class="n">the</span> <span class="n">above</span> <span class="no">Crash</span> <span class="no">Report</span> <span class="n">log</span> <span class="n">file</span> <span class="k">in</span> <span class="n">bug</span> <span class="n">reports</span><span class="p">.</span>
<span class="nf">-</span><span class="o">-</span> <span class="no">Control</span> <span class="n">frame</span> <span class="n">information</span> <span class="o">-----------------------------------------------</span>
<span class="n">c</span><span class="p">:</span><span class="mo">0037</span> <span class="nb">p</span><span class="p">:</span><span class="o">----</span> <span class="n">s</span><span class="p">:</span><span class="mo">0207</span> <span class="n">e</span><span class="p">:</span><span class="mo">000206</span> <span class="no">CFUNC</span> <span class="ss">:match?</span>
<span class="n">c</span><span class="p">:</span><span class="mo">0036</span> <span class="nb">p</span><span class="p">:</span><span class="mo">0006</span> <span class="n">s</span><span class="p">:</span><span class="mo">0202</span> <span class="n">e</span><span class="p">:</span><span class="mo">000201</span> <span class="no">EVAL</span> <span class="p">(</span><span class="n">irb</span><span class="p">):</span><span class="mi">2</span> <span class="p">[</span><span class="no">FINISH</span><span class="p">]</span>
<span class="n">c</span><span class="p">:</span><span class="mo">0035</span> <span class="nb">p</span><span class="p">:</span><span class="o">----</span> <span class="n">s</span><span class="p">:</span><span class="mo">01</span><span class="mi">99</span> <span class="n">e</span><span class="p">:</span><span class="mo">0001</span><span class="mi">98</span> <span class="no">CFUNC</span> <span class="ss">:eval</span>
<span class="n">c</span><span class="p">:</span><span class="mo">0034</span> <span class="nb">p</span><span class="p">:</span><span class="mo">0020</span> <span class="n">s</span><span class="p">:</span><span class="mo">01</span><span class="mi">91</span> <span class="n">e</span><span class="p">:</span><span class="mo">0001</span><span class="mi">90</span> <span class="no">METHOD</span> <span class="sr">/Users/</span><span class="n">andreasalicetti</span><span class="o">/</span><span class="p">.</span><span class="nf">rbenv</span><span class="o">/</span><span class="n">versions</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">2</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">ruby</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">0</span><span class="o">/</span><span class="n">irb</span><span class="o">/</span><span class="n">workspace</span><span class="p">.</span><span class="nf">rb</span><span class="p">:</span><span class="mi">119</span>
<span class="n">c</span><span class="p">:</span><span class="mo">0033</span> <span class="nb">p</span><span class="p">:</span><span class="mo">0153</span> <span class="n">s</span><span class="p">:</span><span class="mo">01</span><span class="mi">83</span> <span class="n">e</span><span class="p">:</span><span class="mo">0001</span><span class="mi">81</span> <span class="no">METHOD</span> <span class="sr">/Users/</span><span class="n">andreasalicetti</span><span class="o">/</span><span class="p">.</span><span class="nf">rbenv</span><span class="o">/</span><span class="n">versions</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">2</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">ruby</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">0</span><span class="o">/</span><span class="n">irb</span><span class="o">/</span><span class="n">context</span><span class="p">.</span><span class="nf">rb</span><span class="p">:</span><span class="mi">502</span>
<span class="n">c</span><span class="p">:</span><span class="mo">0032</span> <span class="nb">p</span><span class="p">:</span><span class="mo">011</span><span class="mi">9</span> <span class="n">s</span><span class="p">:</span><span class="mo">0170</span> <span class="n">e</span><span class="p">:</span><span class="mo">00016</span><span class="mi">9</span> <span class="no">BLOCK</span> <span class="sr">/Users/</span><span class="n">andreasalicetti</span><span class="o">/</span><span class="p">.</span><span class="nf">rbenv</span><span class="o">/</span><span class="n">versions</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">2</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">ruby</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">0</span><span class="o">/</span><span class="n">irb</span><span class="p">.</span><span class="nf">rb</span><span class="p">:</span><span class="mi">588</span>
<span class="n">c</span><span class="p">:</span><span class="mo">0031</span> <span class="nb">p</span><span class="p">:</span><span class="mo">0024</span> <span class="n">s</span><span class="p">:</span><span class="mo">0164</span> <span class="n">e</span><span class="p">:</span><span class="mo">000163</span> <span class="no">METHOD</span> <span class="sr">/Users/</span><span class="n">andreasalicetti</span><span class="o">/</span><span class="p">.</span><span class="nf">rbenv</span><span class="o">/</span><span class="n">versions</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">2</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">ruby</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">0</span><span class="o">/</span><span class="n">irb</span><span class="p">.</span><span class="nf">rb</span><span class="p">:</span><span class="mi">777</span>
<span class="n">c</span><span class="p">:</span><span class="mo">0030</span> <span class="nb">p</span><span class="p">:</span><span class="mo">0007</span> <span class="n">s</span><span class="p">:</span><span class="mo">015</span><span class="mi">8</span> <span class="n">e</span><span class="p">:</span><span class="mo">000157</span> <span class="no">BLOCK</span> <span class="sr">/Users/</span><span class="n">andreasalicetti</span><span class="o">/</span><span class="p">.</span><span class="nf">rbenv</span><span class="o">/</span><span class="n">versions</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">2</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">ruby</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">0</span><span class="o">/</span><span class="n">irb</span><span class="p">.</span><span class="nf">rb</span><span class="p">:</span><span class="mi">567</span>
<span class="n">c</span><span class="p">:</span><span class="mo">002</span><span class="mi">9</span> <span class="nb">p</span><span class="p">:</span><span class="mo">0126</span> <span class="n">s</span><span class="p">:</span><span class="mo">0153</span> <span class="n">e</span><span class="p">:</span><span class="mo">000152</span> <span class="no">BLOCK</span> <span class="sr">/Users/</span><span class="n">andreasalicetti</span><span class="o">/</span><span class="p">.</span><span class="nf">rbenv</span><span class="o">/</span><span class="n">versions</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">2</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">ruby</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">0</span><span class="o">/</span><span class="n">irb</span><span class="o">/</span><span class="n">ruby</span><span class="o">-</span><span class="n">lex</span><span class="p">.</span><span class="nf">rb</span><span class="p">:</span><span class="mi">267</span> <span class="p">[</span><span class="no">FINISH</span><span class="p">]</span>
<span class="n">c</span><span class="p">:</span><span class="mo">002</span><span class="mi">8</span> <span class="nb">p</span><span class="p">:</span><span class="o">----</span> <span class="n">s</span><span class="p">:</span><span class="mo">014</span><span class="mi">9</span> <span class="n">e</span><span class="p">:</span><span class="mo">00014</span><span class="mi">8</span> <span class="no">CFUNC</span> <span class="ss">:loop</span>
<span class="n">c</span><span class="p">:</span><span class="mo">0027</span> <span class="nb">p</span><span class="p">:</span><span class="mo">0005</span> <span class="n">s</span><span class="p">:</span><span class="mo">0145</span> <span class="n">e</span><span class="p">:</span><span class="mo">000144</span> <span class="no">BLOCK</span> <span class="sr">/Users/</span><span class="n">andreasalicetti</span><span class="o">/</span><span class="p">.</span><span class="nf">rbenv</span><span class="o">/</span><span class="n">versions</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">2</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">ruby</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">0</span><span class="o">/</span><span class="n">irb</span><span class="o">/</span><span class="n">ruby</span><span class="o">-</span><span class="n">lex</span><span class="p">.</span><span class="nf">rb</span><span class="p">:</span><span class="mi">249</span> <span class="p">[</span><span class="no">FINISH</span><span class="p">]</span>
<span class="n">c</span><span class="p">:</span><span class="mo">0026</span> <span class="nb">p</span><span class="p">:</span><span class="o">----</span> <span class="n">s</span><span class="p">:</span><span class="mo">0142</span> <span class="n">e</span><span class="p">:</span><span class="mo">000141</span> <span class="no">CFUNC</span> <span class="ss">:catch</span>
<span class="n">c</span><span class="p">:</span><span class="mo">0025</span> <span class="nb">p</span><span class="p">:</span><span class="mo">0010</span> <span class="n">s</span><span class="p">:</span><span class="mo">0137</span> <span class="n">e</span><span class="p">:</span><span class="mo">000136</span> <span class="no">METHOD</span> <span class="sr">/Users/</span><span class="n">andreasalicetti</span><span class="o">/</span><span class="p">.</span><span class="nf">rbenv</span><span class="o">/</span><span class="n">versions</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">2</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">ruby</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">0</span><span class="o">/</span><span class="n">irb</span><span class="o">/</span><span class="n">ruby</span><span class="o">-</span><span class="n">lex</span><span class="p">.</span><span class="nf">rb</span><span class="p">:</span><span class="mi">248</span>
<span class="n">c</span><span class="p">:</span><span class="mo">0024</span> <span class="nb">p</span><span class="p">:</span><span class="mo">0050</span> <span class="n">s</span><span class="p">:</span><span class="mo">0132</span> <span class="no">E</span><span class="p">:</span><span class="mo">000</span><span class="n">dd8</span> <span class="no">METHOD</span> <span class="sr">/Users/</span><span class="n">andreasalicetti</span><span class="o">/</span><span class="p">.</span><span class="nf">rbenv</span><span class="o">/</span><span class="n">versions</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">2</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">ruby</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">0</span><span class="o">/</span><span class="n">irb</span><span class="p">.</span><span class="nf">rb</span><span class="p">:</span><span class="mi">566</span>
<span class="n">c</span><span class="p">:</span><span class="mo">0023</span> <span class="nb">p</span><span class="p">:</span><span class="mo">0003</span> <span class="n">s</span><span class="p">:</span><span class="mo">0127</span> <span class="n">e</span><span class="p">:</span><span class="mo">000126</span> <span class="no">BLOCK</span> <span class="sr">/Users/</span><span class="n">andreasalicetti</span><span class="o">/</span><span class="p">.</span><span class="nf">rbenv</span><span class="o">/</span><span class="n">versions</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">2</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">ruby</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">0</span><span class="o">/</span><span class="n">irb</span><span class="p">.</span><span class="nf">rb</span><span class="p">:</span><span class="mi">500</span> <span class="p">[</span><span class="no">FINISH</span><span class="p">]</span>
<span class="n">c</span><span class="p">:</span><span class="mo">0022</span> <span class="nb">p</span><span class="p">:</span><span class="o">----</span> <span class="n">s</span><span class="p">:</span><span class="mo">0124</span> <span class="n">e</span><span class="p">:</span><span class="mo">000123</span> <span class="no">CFUNC</span> <span class="ss">:catch</span>
<span class="n">c</span><span class="p">:</span><span class="mo">0021</span> <span class="nb">p</span><span class="p">:</span><span class="mo">0050</span> <span class="n">s</span><span class="p">:</span><span class="mo">011</span><span class="mi">9</span> <span class="no">E</span><span class="p">:</span><span class="mo">000</span><span class="n">d50</span> <span class="no">METHOD</span> <span class="sr">/Users/</span><span class="n">andreasalicetti</span><span class="o">/</span><span class="p">.</span><span class="nf">rbenv</span><span class="o">/</span><span class="n">versions</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">2</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">ruby</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">0</span><span class="o">/</span><span class="n">irb</span><span class="p">.</span><span class="nf">rb</span><span class="p">:</span><span class="mi">499</span>
<span class="n">c</span><span class="p">:</span><span class="mo">0020</span> <span class="nb">p</span><span class="p">:</span><span class="mo">006</span><span class="mi">9</span> <span class="n">s</span><span class="p">:</span><span class="mo">0113</span> <span class="n">e</span><span class="p">:</span><span class="mo">000112</span> <span class="no">METHOD</span> <span class="sr">/Users/</span><span class="n">andreasalicetti</span><span class="o">/</span><span class="p">.</span><span class="nf">rbenv</span><span class="o">/</span><span class="n">versions</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">2</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">ruby</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">0</span><span class="o">/</span><span class="n">irb</span><span class="p">.</span><span class="nf">rb</span><span class="p">:</span><span class="mi">421</span>
<span class="n">c</span><span class="p">:</span><span class="mo">001</span><span class="mi">9</span> <span class="nb">p</span><span class="p">:</span><span class="mo">0012</span> <span class="n">s</span><span class="p">:</span><span class="mo">0107</span> <span class="n">e</span><span class="p">:</span><span class="mo">000106</span> <span class="no">TOP</span> <span class="sr">/Users/</span><span class="n">andreasalicetti</span><span class="o">/</span><span class="p">.</span><span class="nf">rbenv</span><span class="o">/</span><span class="n">versions</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">2</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">ruby</span><span class="o">/</span><span class="n">gems</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">0</span><span class="o">/</span><span class="n">gems</span><span class="o">/</span><span class="n">irb</span><span class="o">-</span><span class="mf">1.6</span><span class="o">.</span><span class="mi">2</span><span class="o">/</span><span class="n">exe</span><span class="o">/</span><span class="n">irb</span><span class="p">:</span><span class="mi">11</span> <span class="p">[</span><span class="no">FINISH</span><span class="p">]</span>
<span class="n">c</span><span class="p">:</span><span class="mo">001</span><span class="mi">8</span> <span class="nb">p</span><span class="p">:</span><span class="o">----</span> <span class="n">s</span><span class="p">:</span><span class="mo">0104</span> <span class="n">e</span><span class="p">:</span><span class="mo">000103</span> <span class="no">CFUNC</span> <span class="ss">:load</span>
<span class="n">c</span><span class="p">:</span><span class="mo">0017</span> <span class="nb">p</span><span class="p">:</span><span class="mo">007</span><span class="mi">8</span> <span class="n">s</span><span class="p">:</span><span class="mo">00</span><span class="mi">99</span> <span class="n">e</span><span class="p">:</span><span class="mo">0000</span><span class="mi">98</span> <span class="no">TOP</span> <span class="sr">/Users/</span><span class="n">andreasalicetti</span><span class="o">/</span><span class="p">.</span><span class="nf">rbenv</span><span class="o">/</span><span class="n">versions</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">2</span><span class="o">/</span><span class="n">bin</span><span class="o">/</span><span class="n">irb</span><span class="p">:</span><span class="mi">25</span> <span class="p">[</span><span class="no">FINISH</span><span class="p">]</span>
<span class="n">c</span><span class="p">:</span><span class="mo">0016</span> <span class="nb">p</span><span class="p">:</span><span class="o">----</span> <span class="n">s</span><span class="p">:</span><span class="mo">00</span><span class="mi">94</span> <span class="n">e</span><span class="p">:</span><span class="mo">0000</span><span class="mi">93</span> <span class="no">CFUNC</span> <span class="ss">:load</span>
<span class="n">c</span><span class="p">:</span><span class="mo">0015</span> <span class="nb">p</span><span class="p">:</span><span class="mo">0064</span> <span class="n">s</span><span class="p">:</span><span class="mo">00</span><span class="mi">89</span> <span class="n">e</span><span class="p">:</span><span class="mo">0000</span><span class="mi">88</span> <span class="no">METHOD</span> <span class="sr">/Users/</span><span class="n">andreasalicetti</span><span class="o">/</span><span class="p">.</span><span class="nf">rbenv</span><span class="o">/</span><span class="n">versions</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">2</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">ruby</span><span class="o">/</span><span class="n">site_ruby</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">0</span><span class="o">/</span><span class="n">bundler</span><span class="o">/</span><span class="n">cli</span><span class="o">/</span><span class="nb">exec</span><span class="p">.</span><span class="nf">rb</span><span class="p">:</span><span class="mi">58</span>
<span class="n">c</span><span class="p">:</span><span class="mo">0014</span> <span class="nb">p</span><span class="p">:</span><span class="mo">0050</span> <span class="n">s</span><span class="p">:</span><span class="mo">00</span><span class="mi">83</span> <span class="n">e</span><span class="p">:</span><span class="mo">0000</span><span class="mi">82</span> <span class="no">METHOD</span> <span class="sr">/Users/</span><span class="n">andreasalicetti</span><span class="o">/</span><span class="p">.</span><span class="nf">rbenv</span><span class="o">/</span><span class="n">versions</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">2</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">ruby</span><span class="o">/</span><span class="n">site_ruby</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">0</span><span class="o">/</span><span class="n">bundler</span><span class="o">/</span><span class="n">cli</span><span class="o">/</span><span class="nb">exec</span><span class="p">.</span><span class="nf">rb</span><span class="p">:</span><span class="mi">23</span>
<span class="n">c</span><span class="p">:</span><span class="mo">0013</span> <span class="nb">p</span><span class="p">:</span><span class="mo">0034</span> <span class="n">s</span><span class="p">:</span><span class="mo">007</span><span class="mi">8</span> <span class="n">e</span><span class="p">:</span><span class="mo">000077</span> <span class="no">METHOD</span> <span class="sr">/Users/</span><span class="n">andreasalicetti</span><span class="o">/</span><span class="p">.</span><span class="nf">rbenv</span><span class="o">/</span><span class="n">versions</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">2</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">ruby</span><span class="o">/</span><span class="n">site_ruby</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">0</span><span class="o">/</span><span class="n">bundler</span><span class="o">/</span><span class="n">cli</span><span class="p">.</span><span class="nf">rb</span><span class="p">:</span><span class="mi">492</span>
<span class="n">c</span><span class="p">:</span><span class="mo">0012</span> <span class="nb">p</span><span class="p">:</span><span class="mo">0054</span> <span class="n">s</span><span class="p">:</span><span class="mo">0073</span> <span class="n">e</span><span class="p">:</span><span class="mo">000072</span> <span class="no">METHOD</span> <span class="sr">/Users/</span><span class="n">andreasalicetti</span><span class="o">/</span><span class="p">.</span><span class="nf">rbenv</span><span class="o">/</span><span class="n">versions</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">2</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">ruby</span><span class="o">/</span><span class="n">site_ruby</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">0</span><span class="o">/</span><span class="n">bundler</span><span class="o">/</span><span class="n">vendor</span><span class="o">/</span><span class="n">thor</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">thor</span><span class="o">/</span><span class="n">command</span><span class="p">.</span><span class="nf">rb</span><span class="p">:</span><span class="mi">28</span>
<span class="n">c</span><span class="p">:</span><span class="mo">0011</span> <span class="nb">p</span><span class="p">:</span><span class="mo">0040</span> <span class="n">s</span><span class="p">:</span><span class="mo">0065</span> <span class="n">e</span><span class="p">:</span><span class="mo">000064</span> <span class="no">METHOD</span> <span class="sr">/Users/</span><span class="n">andreasalicetti</span><span class="o">/</span><span class="p">.</span><span class="nf">rbenv</span><span class="o">/</span><span class="n">versions</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">2</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">ruby</span><span class="o">/</span><span class="n">site_ruby</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">0</span><span class="o">/</span><span class="n">bundler</span><span class="o">/</span><span class="n">vendor</span><span class="o">/</span><span class="n">thor</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">thor</span><span class="o">/</span><span class="n">invocation</span><span class="p">.</span><span class="nf">rb</span><span class="p">:</span><span class="mi">127</span>
<span class="n">c</span><span class="p">:</span><span class="mo">0010</span> <span class="nb">p</span><span class="p">:</span><span class="mo">0213</span> <span class="n">s</span><span class="p">:</span><span class="mo">005</span><span class="mi">8</span> <span class="n">e</span><span class="p">:</span><span class="mo">000057</span> <span class="no">METHOD</span> <span class="sr">/Users/</span><span class="n">andreasalicetti</span><span class="o">/</span><span class="p">.</span><span class="nf">rbenv</span><span class="o">/</span><span class="n">versions</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">2</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">ruby</span><span class="o">/</span><span class="n">site_ruby</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">0</span><span class="o">/</span><span class="n">bundler</span><span class="o">/</span><span class="n">vendor</span><span class="o">/</span><span class="n">thor</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">thor</span><span class="p">.</span><span class="nf">rb</span><span class="p">:</span><span class="mi">527</span>
<span class="n">c</span><span class="p">:</span><span class="mo">000</span><span class="mi">9</span> <span class="nb">p</span><span class="p">:</span><span class="mo">000</span><span class="mi">8</span> <span class="n">s</span><span class="p">:</span><span class="mo">0045</span> <span class="n">e</span><span class="p">:</span><span class="mo">000044</span> <span class="no">METHOD</span> <span class="sr">/Users/</span><span class="n">andreasalicetti</span><span class="o">/</span><span class="p">.</span><span class="nf">rbenv</span><span class="o">/</span><span class="n">versions</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">2</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">ruby</span><span class="o">/</span><span class="n">site_ruby</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">0</span><span class="o">/</span><span class="n">bundler</span><span class="o">/</span><span class="n">cli</span><span class="p">.</span><span class="nf">rb</span><span class="p">:</span><span class="mi">34</span>
<span class="n">c</span><span class="p">:</span><span class="mo">000</span><span class="mi">8</span> <span class="nb">p</span><span class="p">:</span><span class="mo">0044</span> <span class="n">s</span><span class="p">:</span><span class="mo">0040</span> <span class="n">e</span><span class="p">:</span><span class="mo">00003</span><span class="mi">9</span> <span class="no">METHOD</span> <span class="sr">/Users/</span><span class="n">andreasalicetti</span><span class="o">/</span><span class="p">.</span><span class="nf">rbenv</span><span class="o">/</span><span class="n">versions</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">2</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">ruby</span><span class="o">/</span><span class="n">site_ruby</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">0</span><span class="o">/</span><span class="n">bundler</span><span class="o">/</span><span class="n">vendor</span><span class="o">/</span><span class="n">thor</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">thor</span><span class="o">/</span><span class="n">base</span><span class="p">.</span><span class="nf">rb</span><span class="p">:</span><span class="mi">584</span>
<span class="n">c</span><span class="p">:</span><span class="mo">0007</span> <span class="nb">p</span><span class="p">:</span><span class="mo">0022</span> <span class="n">s</span><span class="p">:</span><span class="mo">0033</span> <span class="n">e</span><span class="p">:</span><span class="mo">000032</span> <span class="no">METHOD</span> <span class="sr">/Users/</span><span class="n">andreasalicetti</span><span class="o">/</span><span class="p">.</span><span class="nf">rbenv</span><span class="o">/</span><span class="n">versions</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">2</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">ruby</span><span class="o">/</span><span class="n">site_ruby</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">0</span><span class="o">/</span><span class="n">bundler</span><span class="o">/</span><span class="n">cli</span><span class="p">.</span><span class="nf">rb</span><span class="p">:</span><span class="mi">28</span>
<span class="n">c</span><span class="p">:</span><span class="mo">0006</span> <span class="nb">p</span><span class="p">:</span><span class="mo">0042</span> <span class="n">s</span><span class="p">:</span><span class="mo">002</span><span class="mi">8</span> <span class="n">e</span><span class="p">:</span><span class="mo">000027</span> <span class="no">BLOCK</span> <span class="sr">/Users/</span><span class="n">andreasalicetti</span><span class="o">/</span><span class="p">.</span><span class="nf">rbenv</span><span class="o">/</span><span class="n">versions</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">2</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">ruby</span><span class="o">/</span><span class="n">gems</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">0</span><span class="o">/</span><span class="n">gems</span><span class="o">/</span><span class="n">bundler</span><span class="o">-</span><span class="mf">2.4</span><span class="o">.</span><span class="mi">22</span><span class="o">/</span><span class="n">exe</span><span class="o">/</span><span class="n">bundle</span><span class="p">:</span><span class="mi">37</span>
<span class="n">c</span><span class="p">:</span><span class="mo">0005</span> <span class="nb">p</span><span class="p">:</span><span class="mo">0007</span> <span class="n">s</span><span class="p">:</span><span class="mo">0022</span> <span class="n">e</span><span class="p">:</span><span class="mo">000021</span> <span class="no">METHOD</span> <span class="sr">/Users/</span><span class="n">andreasalicetti</span><span class="o">/</span><span class="p">.</span><span class="nf">rbenv</span><span class="o">/</span><span class="n">versions</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">2</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">ruby</span><span class="o">/</span><span class="n">site_ruby</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">0</span><span class="o">/</span><span class="n">bundler</span><span class="o">/</span><span class="n">friendly_errors</span><span class="p">.</span><span class="nf">rb</span><span class="p">:</span><span class="mi">117</span>
<span class="n">c</span><span class="p">:</span><span class="mo">0004</span> <span class="nb">p</span><span class="p">:</span><span class="mo">010</span><span class="mi">8</span> <span class="n">s</span><span class="p">:</span><span class="mo">0017</span> <span class="no">E</span><span class="p">:</span><span class="mo">001</span><span class="mi">9</span><span class="n">b8</span> <span class="no">TOP</span> <span class="sr">/Users/</span><span class="n">andreasalicetti</span><span class="o">/</span><span class="p">.</span><span class="nf">rbenv</span><span class="o">/</span><span class="n">versions</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">2</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">ruby</span><span class="o">/</span><span class="n">gems</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">0</span><span class="o">/</span><span class="n">gems</span><span class="o">/</span><span class="n">bundler</span><span class="o">-</span><span class="mf">2.4</span><span class="o">.</span><span class="mi">22</span><span class="o">/</span><span class="n">exe</span><span class="o">/</span><span class="n">bundle</span><span class="p">:</span><span class="mi">29</span> <span class="p">[</span><span class="no">FINISH</span><span class="p">]</span>
<span class="n">c</span><span class="p">:</span><span class="mo">0003</span> <span class="nb">p</span><span class="p">:</span><span class="o">----</span> <span class="n">s</span><span class="p">:</span><span class="mo">0013</span> <span class="n">e</span><span class="p">:</span><span class="mo">000012</span> <span class="no">CFUNC</span> <span class="ss">:load</span>
<span class="n">c</span><span class="p">:</span><span class="mo">0002</span> <span class="nb">p</span><span class="p">:</span><span class="mo">00</span><span class="mi">81</span> <span class="n">s</span><span class="p">:</span><span class="mo">000</span><span class="mi">8</span> <span class="no">E</span><span class="p">:</span><span class="mo">000220</span> <span class="no">EVAL</span> <span class="sr">/Users/</span><span class="n">andreasalicetti</span><span class="o">/</span><span class="p">.</span><span class="nf">rbenv</span><span class="o">/</span><span class="n">versions</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">2</span><span class="o">/</span><span class="n">bin</span><span class="o">/</span><span class="n">bundle</span><span class="p">:</span><span class="mi">25</span> <span class="p">[</span><span class="no">FINISH</span><span class="p">]</span>
<span class="n">c</span><span class="p">:</span><span class="mo">0001</span> <span class="nb">p</span><span class="p">:</span><span class="mo">0000</span> <span class="n">s</span><span class="p">:</span><span class="mo">0003</span> <span class="no">E</span><span class="p">:</span><span class="mo">001</span><span class="mi">980</span> <span class="no">DUMMY</span> <span class="p">[</span><span class="no">FINISH</span><span class="p">]</span>
</code></pre>
<p>Sometimes this happens the very first time I try to execute the command, some other times I have to try a couple of times to see that Segmentation Fault (but usually within the first 5 attempts).</p> Ruby master - Bug #19986 (Open): Win32: `HOME` is set to just `HOMEDRIVE` if `HOMEPATH` is unsethttps://bugs.ruby-lang.org/issues/199862023-11-05T03:15:02Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<pre><code>$ env -u HOME -u USERPROFILE -u HOMEPATH HOMEDRIVE=no/such/home ./miniruby.exe -e 'p ENV["HOME"], Dir.home'
"no/such/home"
"no/such/home"
</code></pre>
<p><code>HOMEDRIVE</code> should be ignored without <code>HOMEPATH</code>, and <code>HOME</code> should fallback to <code>CSIDL_PROFILE</code>.</p> Ruby master - Bug #19920 (Open): Ruby 3.1 fails to build with --enable-shared on macos-arm64: is ...https://bugs.ruby-lang.org/issues/199202023-10-12T11:02:55ZEregon (Benoit Daloze)
<p>See <a href="https://github.com/ruby/ruby-builder/actions/runs/6494296018/job/17636968796#step:18:9" class="external">https://github.com/ruby/ruby-builder/actions/runs/6494296018/job/17636968796#step:18:9</a></p>
<pre><code>installing bundled gems: /Users/runner/hostedtoolcache/Ruby/3.1.4/arm64/lib/ruby/gems/3.1.0
minitest 5.15.0
power_assert 2.0.1
rake 13.0.6
test-unit 3.5.3
rexml 3.2.5
rss 0.2.9
net-ftp 0.1.3
net-imap 0.2.3
net-pop 0.1.1
net-smtp 0.3.1
matrix 0.4.2
prime 0.1.2
rbs 2.7.0
Building native extensions. This could take a while...
/private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/rubygems/ext/builder.rb:102:in `run': ERROR: Failed to build gem native extension. (Gem::Ext::BuildError)
current directory: /Users/runner/hostedtoolcache/Ruby/3.1.4/arm64/lib/ruby/gems/3.1.0/gems/rbs-2.7.0/ext/rbs_extension
/Users/runner/hostedtoolcache/Ruby/3.1.4/arm64/bin/ruby -I /private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib extconf.rb
checking for whether -std=c99 is accepted as CFLAGS... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/runner/hostedtoolcache/Ruby/3.1.4/arm64/bin/$(RUBY_BASE_NAME)
/private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/mkmf.rb:490:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/mkmf.rb:616:in `block in try_compile'
from /private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/mkmf.rb:563:in `with_werror'
from /private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/mkmf.rb:616:in `try_compile'
from /private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/mkmf.rb:680:in `try_cflags'
from /private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/mkmf.rb:1025:in `block (2 levels) in append_cflags'
from /private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/mkmf.rb:989:in `block in checking_for'
from /private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/mkmf.rb:354:in `block (2 levels) in postpone'
from /private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/mkmf.rb:324:in `open'
from /private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/mkmf.rb:354:in `block in postpone'
from /private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/mkmf.rb:324:in `open'
from /private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/mkmf.rb:350:in `postpone'
from /private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/mkmf.rb:988:in `checking_for'
from /private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/mkmf.rb:1024:in `block in append_cflags'
from /private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/mkmf.rb:1023:in `each'
from /private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/mkmf.rb:1023:in `append_cflags'
from extconf.rb:3:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Users/runner/hostedtoolcache/Ruby/3.1.4/arm64/lib/ruby/gems/3.1.0/extensions/arm64-darwin-22/3.1.0/rbs-2.7.0/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /Users/runner/hostedtoolcache/Ruby/3.1.4/arm64/lib/ruby/gems/3.1.0/gems/rbs-2.7.0 for inspection.
Results logged to /Users/runner/hostedtoolcache/Ruby/3.1.4/arm64/lib/ruby/gems/3.1.0/extensions/arm64-darwin-22/3.1.0/rbs-2.7.0/gem_make.out
from /private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/rubygems/ext/ext_conf_builder.rb:28:in `build'
from /private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/rubygems/ext/builder.rb:171:in `build_extension'
from /private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/rubygems/ext/builder.rb:205:in `block in build_extensions'
from /private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/rubygems/ext/builder.rb:202:in `each'
from /private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/rubygems/ext/builder.rb:202:in `build_extensions'
from /private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/rubygems/installer.rb:843:in `build_extensions'
from /private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/rubygems/installer.rb:326:in `install'
from ./tool/rbinstall.rb:899:in `block in install'
from ./tool/rbinstall.rb:713:in `no_write'
from ./tool/rbinstall.rb:899:in `install'
from ./tool/rbinstall.rb:1063:in `block (2 levels) in <main>'
from ./tool/rbinstall.rb:1044:in `foreach'
from ./tool/rbinstall.rb:1044:in `block in <main>'
from ./tool/rbinstall.rb:1119:in `block in <main>'
from ./tool/rbinstall.rb:1116:in `each'
from ./tool/rbinstall.rb:1116:in `<main>'
/private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/rubygems/ext/builder.rb:102:in `run': extconf failed, exit code 1 (Gem::InstallError)
from /private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/rubygems/ext/ext_conf_builder.rb:28:in `build'
from /private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/rubygems/ext/builder.rb:171:in `build_extension'
from /private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/rubygems/ext/builder.rb:205:in `block in build_extensions'
from /private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/rubygems/ext/builder.rb:202:in `each'
from /private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/rubygems/ext/builder.rb:202:in `build_extensions'
from /private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/rubygems/installer.rb:843:in `build_extensions'
from /private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/lib/rubygems/installer.rb:326:in `install'
from ./tool/rbinstall.rb:899:in `block in install'
from ./tool/rbinstall.rb:713:in `no_write'
from ./tool/rbinstall.rb:899:in `install'
from ./tool/rbinstall.rb:1063:in `block (2 levels) in <main>'
from ./tool/rbinstall.rb:1044:in `foreach'
from ./tool/rbinstall.rb:1044:in `block in <main>'
from ./tool/rbinstall.rb:1119:in `block in <main>'
from ./tool/rbinstall.rb:1116:in `each'
from ./tool/rbinstall.rb:1116:in `<main>'
make: *** [do-install-nodoc] Error 1
BUILD FAILED (macOS 13.6 using ruby-build 20231012)
</code></pre>
<p>And the mkmf.log:</p>
<pre><code>DYLD_FALLBACK_LIBRARY_PATH=.:/Users/runner/hostedtoolcache/Ruby/3.1.4/arm64/lib:/private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4 "clang -o conftest -I/Users/runner/hostedtoolcache/Ruby/3.1.4/arm64/include/ruby-3.1.0/arm64-darwin22 -I/Users/runner/hostedtoolcache/Ruby/3.1.4/arm64/include/ruby-3.1.0/ruby/backward -I/Users/runner/hostedtoolcache/Ruby/3.1.4/arm64/include/ruby-3.1.0 -I. -I/Users/runner/hostedtoolcache/Ruby/3.1.4/arm64/include -DENABLE_PATH_CHECK=0 -I/opt/homebrew/opt/gmp/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -fdeclspec -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens -Wundef -fno-common -pipe conftest.c -L. -L/Users/runner/hostedtoolcache/Ruby/3.1.4/arm64/lib -L. -L/Users/runner/hostedtoolcache/Ruby/3.1.4/arm64/lib -fstack-protector-strong -L/opt/homebrew/opt/gmp/lib -lruby.3.1 "
dyld[47952]: terminating because inserted dylib '/private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/libruby.3.1.dylib' could not be loaded: tried: '/private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/libruby.3.1.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need '')), '/System/Volumes/Preboot/Cryptexes/OS/private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/libruby.3.1.dylib' (no such file), '/private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/libruby.3.1.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need '')), './libruby.3.1.dylib' (no such file), '/Users/runner/hostedtoolcache/Ruby/3.1.4/arm64/lib/libruby.3.1.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need ''))
dyld[47952]: tried: '/private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/libruby.3.1.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need '')), '/System/Volumes/Preboot/Cryptexes/OS/private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/libruby.3.1.dylib' (no such file), '/private/var/folders/df/1dm_t2rx0054k7bw1g_7nyl80000gn/T/ruby-build.20231012101401.55539.tTlMYN/ruby-3.1.4/libruby.3.1.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need '')), './libruby.3.1.dylib' (no such file), '/Users/runner/hostedtoolcache/Ruby/3.1.4/arm64/lib/libruby.3.1.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need ''))
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return !!argv[argc];
6: }
/* end */
</code></pre>
<p>I believe this bug has nothing to do with ruby-build except that ruby-build does <code>--enable-shared</code> by default.</p>
<p>A known workaround is to use <code>--disable-shared</code>: <a href="https://github.com/rbenv/ruby-build/discussions/1961#discussioncomment-4031745" class="external">https://github.com/rbenv/ruby-build/discussions/1961#discussioncomment-4031745</a><br>
Lots of other people met the same or similar issue as discussed there.<br>
Also discussed in <a href="https://github.com/ruby/rbs/issues/877" class="external">https://github.com/ruby/rbs/issues/877</a></p>
<p>It would be nice if this could be fixed on the 3.1 branch.</p> Ruby master - Bug #19910 (Open): Set#delete_if behavior inconsistent with Array/Hashhttps://bugs.ruby-lang.org/issues/199102023-10-02T21:05:34Zsegiddins (Samuel Giddins)segiddins@segiddins.me
<p>Given the following script:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="c1">#!/usr/bin/env ruby</span>
<span class="nb">require</span> <span class="s1">'set'</span>
<span class="k">def</span> <span class="nf">enum</span><span class="p">(</span><span class="n">collection</span><span class="p">)</span>
<span class="n">i</span> <span class="o">=</span> <span class="mi">0</span>
<span class="n">collection</span><span class="p">.</span><span class="nf">delete_if</span> <span class="k">do</span>
<span class="n">i</span> <span class="o">+=</span> <span class="mi">1</span>
<span class="k">raise</span> <span class="no">ArgumentError</span> <span class="k">if</span> <span class="n">i</span> <span class="o">==</span> <span class="mi">6</span>
<span class="n">i</span><span class="p">.</span><span class="nf">odd?</span>
<span class="k">end</span>
<span class="k">rescue</span> <span class="no">ArgumentError</span>
<span class="k">return</span> <span class="n">collection</span>
<span class="k">end</span>
<span class="n">pp</span> <span class="n">enum</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">6</span><span class="p">,</span> <span class="mi">7</span><span class="p">])</span>
<span class="n">pp</span> <span class="n">enum</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">6</span><span class="p">,</span> <span class="mi">7</span><span class="p">].</span><span class="nf">to_h</span> <span class="p">{</span> <span class="p">[</span><span class="n">_1</span><span class="p">,</span> <span class="n">_1</span><span class="p">]</span> <span class="p">})</span>
<span class="n">pp</span> <span class="n">enum</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">6</span><span class="p">,</span> <span class="mi">7</span><span class="p">].</span><span class="nf">to_set</span><span class="p">)</span>
</code></pre>
<p>It results in:</p>
<pre><code>[1, 3, 5, 6, 7]
{1=>1, 3=>3, 5=>5, 6=>6, 7=>7}
#<Set: {0, 1, 2, 3, 4, 5, 6, 7}>
</code></pre>
<p>As you can see, when an exception is raise inside <code>delete_if</code> on Hash/Array, the already-considered elements are still removed from the array. For <code>Set</code>, no elements are deleted (due to the implementation that builds up an intermediary list of elements to delete, then removes them from the underlying hash afterwards). It would be very helpful if <code>Set#delete_if</code> behaved consistently with other core collection types</p> Ruby master - Bug #19891 (Open): rb_mRubyVMFrozenCore is reported by DTrace but ignored by TraceP...https://bugs.ruby-lang.org/issues/198912023-09-19T06:54:05Zvo.x (Vit Ondruch)v.ondruch@tiscali.cz
<p>This is related to <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: rb_mRubyVMFrozenCore is broken by GC run (Closed)" href="https://bugs.ruby-lang.org/issues/18257">#18257</a> where I wonder why rb_mRubyVMFrozenCore is ignored by TracePoint (if I am not mistaken) <a href="https://github.com/ruby/ruby/blob/647390308239fbf82d159ecd83ed8df090af518d/vm_trace.c#L431" class="external">1</a>:</p>
<pre><code> if (ec->trace_arg == NULL && /* check reentrant */
trace_arg->self != rb_mRubyVMFrozenCore /* skip special methods. TODO: remove it. */) {
</code></pre>
<p>This was introduced in <a class="changeset" title="* vm_core.h (exec_event_hooks): skips RubyVM::FrozenCore. git-svn-id: svn+ssh://ci.ruby-lang.or..." href="https://bugs.ruby-lang.org/projects/ruby-master/repository/git/revisions/1be7c799e6ed39f7ac41906c05db149e8c391add">git|1be7c799e6ed39f7ac41906c05db149e8c391add</a> but hard to guess what was the reason. If there were issues similar to @18257 or if it is by design.</p>
<p>The <code>TODO</code> part was introduced by <a class="changeset" title="* vm_trace.c, vm_core.h: simplify tracing mechanism. (1) add rb_hook_list_t data structure whic..." href="https://bugs.ruby-lang.org/projects/ruby-master/repository/git/revisions/4a4a702e61d1c5585d522f1185a82a5685c554f6">git|4a4a702e61d1c5585d522f1185a82a5685c554f6</a> which also does not give a clue what is intention here.</p>
<p>Generally, my point is that it is strange that DTrace would report about rb_mRubyVMFrozenCore while TracePoint is happy to skip it.</p> Ruby master - Bug #19875 (Open): Ruby 3.0 -> 3.1 Performance regression in String#counthttps://bugs.ruby-lang.org/issues/198752023-09-12T14:18:33Ziz (Illia Zub)
<p><code>String#count</code> became slower since Ruby 3.1. Originally found by <code>@Freaky</code>: <a href="https://github.com/ruby/ruby/pull/4001#issuecomment-1714779781" class="external">https://github.com/ruby/ruby/pull/4001#issuecomment-1714779781</a></p>
<p>Compared using the <a href="https://github.com/benchmark-driver/benchmark-driver" class="external"><code>benchmark-driver</code> gem</a>.</p>
<pre><code>$ benchmark-driver tmp/string_count_benchmark_driver.yml --rbenv '3.1.1;3.1.4;2.7.2;3.2.2;3.0.6'
Calculating -------------------------------------
3.1.1 3.1.4 2.7.2 3.2.2 3.0.6
count 465.804 463.741 865.783 462.711 857.395 i/s - 10.000k times in 21.468251s 21.563768s 11.550239s 21.611783s 11.663235s
Comparison:
count
2.7.2: 865.8 i/s
3.0.6: 857.4 i/s - 1.01x slower
3.1.1: 465.8 i/s - 1.86x slower
3.1.4: 463.7 i/s - 1.87x slower
3.2.2: 462.7 i/s - 1.87x slower
</code></pre>
<p>Benchmark:</p>
<pre><code class="yml syntaxhl" data-language="yml"><span class="s">$ cat ./tmp/string_count_benchmark_driver.yml</span>
<span class="na">loop_count</span><span class="pi">:</span> <span class="s">10_000</span>
<span class="na">prelude</span><span class="pi">:</span> <span class="pi">|</span>
<span class="s">html = "\nruby\n" * 1024 * 1024</span>
<span class="na">benchmark</span><span class="pi">:</span>
<span class="na">count</span><span class="pi">:</span> <span class="s">html.count($/)</span>
</code></pre>
<hr>
<p><em>Initially, I noticed the difference between <code>str.count($/)</code> and <code>str.lines.size</code> when working on the performance improvement: <a href="https://serpapi.com/blog/lines-count-failed-deployments/" class="external">https://serpapi.com/blog/lines-count-failed-deployments/</a></em></p> Ruby master - Bug #19865 (Open): Segfault when calling user signal handlers during VM shutdownhttps://bugs.ruby-lang.org/issues/198652023-09-06T08:56:16Zivoanjo (Ivo Anjo)ivo.anjo@datadoghq.com
<p>Howdy 👋! I work for Datadog <a href="https://github.com/DataDog/dd-trace-rb" class="external">on the <code>ddtrace</code> gem</a> . I've found this issue while investigating a <a href="https://github.com/DataDog/dd-trace-rb/issues/2980" class="external">customer crash report</a>.</p>
<a name="Background"></a>
<h3 >Background<a href="#Background" class="wiki-anchor">¶</a></h3>
<p>The original issue was found in a production app. A number of things need to be in play to cause it.</p>
<p>The <a href="https://rubygems.org/gems/ruby-odbc" class="external"><code>ruby-odbc</code></a> gem provides a way of accessing databases through the ODBC API. It wraps a database connection as a Data object, with a free function that, prior to freeing the native resources, disconnects from the database if the connection was still active.</p>
<p>Because disconnecting from the database is a blocking operation, the gem (reasonably, in my opinion), releases the global VM lock before disconnecting.</p>
<p>The trigger for the crash is:</p>
<ol>
<li>The app in question used puma, and puma installs a <code>Signal.trap('TERM')</code>
</li>
<li>The database object was still connected when the app started to shut down</li>
<li>A VM shutdown starts...</li>
<li>Half-way through shutdown, the VM received a SIGTERM signal, and queued it for processing</li>
<li>The VM calls the free function on all objects</li>
<li>The ruby-odbc gem sees there's an active database connection, and tries to release the GVL to call the blocking disconnect</li>
<li>Before releasing the GVL, the VM checks for pending interruptions</li>
<li>The VM tries to run the Ruby-level signal handler method half-way through VM shutdown, when you can no longer run Ruby code</li>
<li>Segfault</li>
</ol>
<a name="How-to-reproduce-Ruby-version-amp-script"></a>
<h3 >How to reproduce (Ruby version & script)<a href="#How-to-reproduce-Ruby-version-amp-script" class="wiki-anchor">¶</a></h3>
<p>I was able to reproduce on a minimal example on Ruby 3.2.2 (<code>ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-linux]</code>) and recent master (<code>ruby 3.3.0dev (2023-08-17T07:30:01Z master d26b015e83) [x86_64-linux]</code>).</p>
<p>I've put the test-case up on github as well <a href="https://github.com/DataDog/signal-bug-testcase" class="external">https://github.com/DataDog/signal-bug-testcase</a>, but here's the important bits:</p>
<p><code>signal-bug-testcase.rb</code>:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="nb">require</span> <span class="s1">'signal_bug_testcase'</span>
<span class="no">Signal</span><span class="p">.</span><span class="nf">trap</span><span class="p">(</span><span class="s2">"TERM"</span><span class="p">)</span> <span class="p">{</span> <span class="nb">puts</span> <span class="s2">"Hello, world"</span> <span class="p">}</span>
<span class="no">FOO</span> <span class="o">=</span> <span class="no">SignalBugTestcase</span><span class="p">.</span><span class="nf">new</span>
</code></pre>
<p><code>signal_bug_testcase.c</code>:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="c1">#include <ruby.h></span>
<span class="c1">#include <ruby/thread.h></span>
<span class="c1">#include <signal.h></span>
<span class="c1">#include <unistd.h></span>
<span class="n">typedef</span> <span class="n">struct</span> <span class="p">{</span> <span class="n">int</span> <span class="n">dummy</span><span class="p">;</span> <span class="p">}</span> <span class="no">BugTestcase</span><span class="p">;</span>
<span class="n">void</span> <span class="o">*</span><span class="n">test_nogvl</span><span class="p">(</span><span class="n">void</span> <span class="o">*</span><span class="n">unused</span><span class="p">)</span> <span class="p">{</span>
<span class="n">fprintf</span><span class="p">(</span><span class="n">stderr</span><span class="p">,</span> <span class="s2">"GVL released!</span><span class="se">\n</span><span class="s2">"</span><span class="p">);</span>
<span class="k">return</span> <span class="no">NULL</span><span class="p">;</span>
<span class="p">}</span>
<span class="n">static</span> <span class="n">void</span> <span class="n">bug_testcase_free</span><span class="p">(</span><span class="n">void</span><span class="o">*</span> <span class="n">ptr</span><span class="p">)</span> <span class="p">{</span>
<span class="n">fprintf</span><span class="p">(</span><span class="n">stderr</span><span class="p">,</span> <span class="s2">"Free getting called! Sending signal...</span><span class="se">\n</span><span class="s2">"</span><span class="p">);</span>
<span class="n">kill</span><span class="p">(</span><span class="n">getpid</span><span class="p">(),</span> <span class="no">SIGTERM</span><span class="p">);</span>
<span class="n">fprintf</span><span class="p">(</span><span class="n">stderr</span><span class="p">,</span> <span class="s2">"SIGTERM signal queued, trying to release GVL...</span><span class="se">\n</span><span class="s2">"</span><span class="p">);</span>
<span class="n">rb_thread_call_without_gvl</span><span class="p">(</span><span class="n">test_nogvl</span><span class="p">,</span> <span class="no">NULL</span><span class="p">,</span> <span class="no">NULL</span><span class="p">,</span> <span class="no">NULL</span><span class="p">);</span>
<span class="n">fprintf</span><span class="p">(</span><span class="n">stderr</span><span class="p">,</span> <span class="s2">"After releasing GVL!</span><span class="se">\n</span><span class="s2">"</span><span class="p">);</span>
<span class="n">free</span><span class="p">(</span><span class="n">ptr</span><span class="p">);</span>
<span class="p">}</span>
<span class="n">const</span> <span class="n">rb_data_type_t</span> <span class="n">bug_testcase_data_type</span> <span class="o">=</span> <span class="p">{</span>
<span class="p">.</span><span class="nf">wrap_struct_name</span> <span class="o">=</span> <span class="s2">"SignalBugTestcase"</span><span class="p">,</span>
<span class="p">.</span><span class="nf">function</span> <span class="o">=</span> <span class="p">{</span> <span class="no">NULL</span><span class="p">,</span> <span class="n">bug_testcase_free</span><span class="p">,</span> <span class="no">NULL</span> <span class="p">},</span>
<span class="p">.</span><span class="nf">flags</span> <span class="o">=</span> <span class="no">RUBY_TYPED_FREE_IMMEDIATELY</span>
<span class="p">};</span>
<span class="no">VALUE</span> <span class="n">bug_testcase_alloc</span><span class="p">(</span><span class="no">VALUE</span> <span class="n">klass</span><span class="p">)</span> <span class="p">{</span>
<span class="no">BugTestcase</span><span class="o">*</span> <span class="n">obj</span> <span class="o">=</span> <span class="n">calloc</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="n">sizeof</span><span class="p">(</span><span class="no">BugTestcase</span><span class="p">));</span>
<span class="k">return</span> <span class="no">TypedData_Make_Struct</span><span class="p">(</span><span class="n">klass</span><span class="p">,</span> <span class="no">BugTestcase</span><span class="p">,</span> <span class="o">&</span><span class="n">bug_testcase_data_type</span><span class="p">,</span> <span class="n">obj</span><span class="p">);</span>
<span class="p">}</span>
<span class="n">void</span> <span class="no">Init_signal_bug_testcase</span><span class="p">(</span><span class="n">void</span><span class="p">)</span> <span class="p">{</span>
<span class="no">VALUE</span> <span class="n">cBugTestcase</span> <span class="o">=</span> <span class="n">rb_define_class</span><span class="p">(</span><span class="s2">"SignalBugTestcase"</span><span class="p">,</span> <span class="n">rb_cObject</span><span class="p">);</span>
<span class="n">rb_define_alloc_func</span><span class="p">(</span><span class="n">cBugTestcase</span><span class="p">,</span> <span class="n">bug_testcase_alloc</span><span class="p">);</span>
<span class="p">}</span>
</code></pre>
<a name="Expectation-and-result"></a>
<h3 >Expectation and result<a href="#Expectation-and-result" class="wiki-anchor">¶</a></h3>
<p>No segfault happens.</p>
<p>Interestingly, on Ruby 2.7, the VM exits half-way through but doesn't always segfault, but running it a few times always triggers the issue. On 3.2+ it crashes every time for me.</p>
<p>I suspect the right thing here is to no longer accept/try to run any Ruby-level signal handlers after VM shutdown starts.</p>
<p>Here's what I see with this test-case:</p>
<pre><code>$ bundle exec ruby lib/signal-bug-testcase.rb
Free getting called! Sending signal...
SIGTERM signal queued, trying to release GVL...
lib/signal-bug-testcase.rb:3: [BUG] Segmentation fault at 0x0000000000000007
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-linux]
-- Control frame information -----------------------------------------------
c:0003 p:---- s:0011 e:000010 CFUNC :puts
c:0002 p:0005 s:0006 e:000005 BLOCK lib/signal-bug-testcase.rb:3 [FINISH]
c:0001 p:0000 s:0003 E:0001a0 DUMMY [FINISH]
-- Ruby level backtrace information ----------------------------------------
lib/signal-bug-testcase.rb:3:in `block in <main>'
lib/signal-bug-testcase.rb:3:in `puts'
-- Machine register context ------------------------------------------------
RIP: 0x000070aa64cedbe7 RBP: 0x000070aa648e8fd0 RSP: 0x00007ffc5c057608
RAX: 0x0000000000004171 RBX: 0x00007ffc5c057630 RCX: 0x0000000000000001
RDX: 0x00007ffc5c057630 RDI: 0x0000000000000007 RSI: 0x0000000000004171
R8: 0x000000000000021b R9: 0x0000000000000000 R10: 0x000070aa63eff048
R11: 0x0000000000000000 R12: 0x000070aa648e8fd0 R13: 0x0000000000004171
R14: 0x0000000000000007 R15: 0x000070aa648e8ff0 EFL: 0x0000000000010202
-- C level backtrace information -------------------------------------------
ruby-3.2.2/lib/libruby.so.3.2(rb_print_backtrace+0xd) [0x70aa64d5bb5f] ruby-3.2.2/vm_dump.c:785
ruby-3.2.2/lib/libruby.so.3.2(rb_vm_bugreport) ruby-3.2.2/vm_dump.c:1080
ruby-3.2.2/lib/libruby.so.3.2(rb_bug_for_fatal_signal+0xf4) [0x70aa64b52164] ruby-3.2.2/error.c:813
ruby-3.2.2/lib/libruby.so.3.2(sigsegv+0x4d) [0x70aa64cab0fd] ruby-3.2.2/signal.c:964
/lib/x86_64-linux-gnu/libc.so.6(0x70aa64642520) [0x70aa64642520]
ruby-3.2.2/lib/libruby.so.3.2(hash_table_index+0x0) [0x70aa64cedbe7] ruby-3.2.2/symbol.h:72
ruby-3.2.2/lib/libruby.so.3.2(rb_id_table_lookup) ruby-3.2.2/id_table.c:230
ruby-3.2.2/lib/libruby.so.3.2(cached_callable_method_entry+0x24) [0x70aa64d356bb] ruby-3.2.2/vm_method.c:1295
ruby-3.2.2/lib/libruby.so.3.2(callable_method_entry_or_negative) ruby-3.2.2/vm_method.c:1365
ruby-3.2.2/lib/libruby.so.3.2(callable_method_entry) ruby-3.2.2/vm_method.c:1402
ruby-3.2.2/lib/libruby.so.3.2(rb_callable_method_entry) ruby-3.2.2/vm_method.c:1409
ruby-3.2.2/lib/libruby.so.3.2(gccct_method_search_slowpath+0x38) [0x70aa64d36258] ruby-3.2.2/vm_eval.c:434
ruby-3.2.2/lib/libruby.so.3.2(rb_call0+0x267) [0x70aa64d4e877] ruby-3.2.2/vm_eval.c:483
ruby-3.2.2/lib/libruby.so.3.2(rb_call+0x32) [0x70aa64d4f406] ruby-3.2.2/vm_eval.c:877
ruby-3.2.2/lib/libruby.so.3.2(rb_funcallv_kw) ruby-3.2.2/vm_eval.c:1074
ruby-3.2.2/lib/libruby.so.3.2(vm_call_cfunc_with_frame+0x127) [0x70aa64d30277] ruby-3.2.2/vm_insnhelper.c:3268
ruby-3.2.2/lib/libruby.so.3.2(vm_sendish+0x97) [0x70aa64d407a4] ruby-3.2.2/vm_insnhelper.c:5080
ruby-3.2.2/lib/libruby.so.3.2(vm_exec_core) ruby-3.2.2/insns.def:820
ruby-3.2.2/lib/libruby.so.3.2(rb_vm_exec+0xd3) [0x70aa64d460d3] ruby-3.2.2/vm.c:2374
ruby-3.2.2/lib/libruby.so.3.2(rb_vm_invoke_proc+0x5f) [0x70aa64d4bfcf] ruby-3.2.2/vm.c:1603
ruby-3.2.2/lib/libruby.so.3.2(vm_call0_body+0x5df) [0x70aa64d4c5cf] ruby-3.2.2/vm_eval.c:274
ruby-3.2.2/lib/libruby.so.3.2(vm_call0_cc+0x77) [0x70aa64d4e7e7] ruby-3.2.2/vm_eval.c:87
ruby-3.2.2/lib/libruby.so.3.2(rb_call0) ruby-3.2.2/vm_eval.c:551
ruby-3.2.2/lib/libruby.so.3.2(rb_call+0x32) [0x70aa64d4f406] ruby-3.2.2/vm_eval.c:877
ruby-3.2.2/lib/libruby.so.3.2(rb_funcallv_kw) ruby-3.2.2/vm_eval.c:1074
ruby-3.2.2/lib/libruby.so.3.2(rb_eval_cmd_kw+0x142) [0x70aa64d4f562] ruby-3.2.2/vm_eval.c:1923
ruby-3.2.2/lib/libruby.so.3.2(signal_exec+0xf6) [0x70aa64caae16] ruby-3.2.2/signal.c:1064
ruby-3.2.2/lib/libruby.so.3.2(rb_threadptr_execute_interrupts+0x36b) [0x70aa64cf7078] ruby-3.2.2/thread.c:2334
ruby-3.2.2/lib/libruby.so.3.2(rb_threadptr_execute_interrupts) ruby-3.2.2/thread.c:2291
ruby-3.2.2/lib/libruby.so.3.2(rb_vm_check_ints+0xb) [0x70aa64cf7ac5] ruby-3.2.2/vm_core.h:1994
ruby-3.2.2/lib/libruby.so.3.2(rb_vm_check_ints) ruby-3.2.2/vm_core.h:1985
ruby-3.2.2/lib/libruby.so.3.2(unblock_function_set) ruby-3.2.2/thread.c:320
ruby-3.2.2/lib/libruby.so.3.2(blocking_region_begin) ruby-3.2.2/thread.c:1485
ruby-3.2.2/lib/libruby.so.3.2(rb_nogvl+0xbf) [0x70aa64cf90cf] ruby-3.2.2/thread.c:1548
signal-bug-testcase-2/lib/signal_bug_testcase.so(fprintf+0x0) [0x70aa6518f299] ../../../../ext/signal_bug_testcase/signal_bug_testcase.c:17
signal-bug-testcase-2/lib/signal_bug_testcase.so(bug_testcase_free) ../../../../ext/signal_bug_testcase/signal_bug_testcase.c:18
ruby-3.2.2/lib/libruby.so.3.2(run_final+0xf) [0x70aa64b73172] ruby-3.2.2/gc.c:4388
ruby-3.2.2/lib/libruby.so.3.2(finalize_list) ruby-3.2.2/gc.c:4407
ruby-3.2.2/lib/libruby.so.3.2(finalize_deferred_heap_pages) ruby-3.2.2/gc.c:4436
ruby-3.2.2/lib/libruby.so.3.2(rb_objspace_call_finalizer+0x350) [0x70aa64b80d70] ruby-3.2.2/gc.c:4573
ruby-3.2.2/lib/libruby.so.3.2(rb_ec_finalize+0x2a) [0x70aa64b5d6d1] ruby-3.2.2/eval.c:168
ruby-3.2.2/lib/libruby.so.3.2(rb_ec_cleanup) ruby-3.2.2/eval.c:262
ruby-3.2.2/lib/libruby.so.3.2(ruby_run_node+0x9d) [0x70aa64b5d91d] ruby-3.2.2/eval.c:330
ruby-3.2.2/bin/ruby(rb_main+0x21) [0x5d5d1295f187] ./main.c:38
ruby-3.2.2/bin/ruby(main) ./main.c:57
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_call_main+0x80) [0x70aa64629d90] ../sysdeps/nptl/libc_start_call_main.h:58
/lib/x86_64-linux-gnu/libc.so.6(call_init+0x0) [0x70aa64629e40] ../csu/libc-start.c:392
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main_impl) ../csu/libc-start.c:379
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main) (null):0
[0x5d5d1295f1d5]
</code></pre> Ruby master - Bug #19831 (Open): warning message of linker with macOS Sonoma betahttps://bugs.ruby-lang.org/issues/198312023-08-04T09:21:01Zhsbt (Hiroshi SHIBATA)hsbt@ruby-lang.org
<p>Xcode 15 beta and macOS Sonoma beta show the following warnings with <code>make</code></p>
<pre><code>(snip)
linking miniruby
ld: warning: ignoring duplicate library '-lpthread'
miniruby: replacing existing signature
exe/ruby: replacing existing signature
builtin_binary.inc updated
compiling builtin.c
linking static-library libruby.3.3-static.a
linking ruby
ld: warning: ignoring duplicate library '-lgmp'
ld: warning: ignoring duplicate library '-ldl'
ld: warning: ignoring duplicate library '-lobjc'
ld: warning: ignoring duplicate library '-lpthread'
ld: warning: ignoring duplicate library '-lpthread'
(snip)
</code></pre>
<p>I'm not investigate that yet. It may be caused by <code>ld-prime</code> that is new linker of macOS platform.</p>
<pre><code>$ pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
package-id: com.apple.pkg.CLTools_Executables
version: 15.0.0.0.1.1690355577
volume: /
location: /
install-time: 1690967267
</code></pre> Ruby master - Bug #19765 (Open): Ractor.make_shareable ignores self of a proc created from a Methodhttps://bugs.ruby-lang.org/issues/197652023-07-13T03:05:31ZEthan (Ethan -)notethan@gmail.com
<p>An unshareable receiver of a Proc or a Method will cause make_shareable to error, but this does not happen with a proc from Method#to_proc:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="n">str</span> <span class="o">=</span> <span class="s2">""</span>
<span class="n">a</span> <span class="o">=</span> <span class="n">str</span><span class="p">.</span><span class="nf">instance_exec</span> <span class="p">{</span> <span class="nb">proc</span> <span class="p">{</span> <span class="nb">to_s</span> <span class="p">}</span> <span class="p">}</span>
<span class="no">Ractor</span><span class="p">.</span><span class="nf">make_shareable</span> <span class="n">a</span>
<span class="c1"># => <internal:ractor>:820:in `make_shareable': Proc's self is not shareable: #<Proc:0x00000001064b62c8 (irb):1> (Ractor::IsolationError)</span>
<span class="n">b</span> <span class="o">=</span> <span class="n">str</span><span class="p">.</span><span class="nf">instance_exec</span> <span class="p">{</span> <span class="nb">method</span><span class="p">(</span><span class="ss">:to_s</span><span class="p">)</span> <span class="p">}</span>
<span class="no">Ractor</span><span class="p">.</span><span class="nf">make_shareable</span> <span class="n">b</span>
<span class="c1"># => <internal:ractor>:820:in `make_shareable': can not make shareable object for #<Method: String#to_s()> (Ractor::Error)</span>
<span class="n">c</span> <span class="o">=</span> <span class="n">str</span><span class="p">.</span><span class="nf">instance_exec</span> <span class="p">{</span> <span class="nb">method</span><span class="p">(</span><span class="ss">:to_s</span><span class="p">).</span><span class="nf">to_proc</span> <span class="p">}</span>
<span class="no">Ractor</span><span class="p">.</span><span class="nf">make_shareable</span> <span class="n">c</span>
<span class="n">c</span><span class="p">.</span><span class="nf">call</span>
<span class="c1"># => ""</span>
<span class="n">str</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">=</span> <span class="s2">"!"</span>
<span class="n">c</span><span class="p">.</span><span class="nf">call</span>
<span class="c1"># => "!"</span>
</code></pre>
<p>Related, maybe:<br>
<a class="issue tracker-1 status-2 priority-4 priority-default" title="Bug: Proc objects are not traversed for shareable check during Ractor.make_shareable(prok) (Assigned)" href="https://bugs.ruby-lang.org/issues/19372">#19372</a><br>
<a class="issue tracker-1 status-2 priority-4 priority-default" title="Bug: Issue with Ractor.make_shareable with curried procs (Assigned)" href="https://bugs.ruby-lang.org/issues/19374">#19374</a></p>
<p>Tangential: why does Proc cause Ractor::IsolationError but Method causes Ractor::Error?</p> Ruby master - Bug #19756 (Open): URI::HTTP.build does not accept a host of `_gateway`, but `URI.p...https://bugs.ruby-lang.org/issues/197562023-07-04T02:11:27Zpostmodern (Hal Brodigan)postmodern.mod3@gmail.com
<p>I noticed a difference in behavior between <code>URI::HTTP.build</code> and <code>URI.parse</code>. <code>URI::HTTP.build</code> will not accept <code>host:</code> value of <code>_gateway</code>, but <code>URI.parse</code> will.</p>
<a name="Steps-To-Reproduce"></a>
<h2 >Steps To Reproduce<a href="#Steps-To-Reproduce" class="wiki-anchor">¶</a></h2>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="no">URI</span><span class="o">::</span><span class="no">HTTP</span><span class="p">.</span><span class="nf">build</span><span class="p">(</span><span class="ss">host: </span><span class="s2">"_gateway"</span><span class="p">)</span>
</code></pre>
<p>vs.</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="no">URI</span><span class="p">.</span><span class="nf">parse</span><span class="p">(</span><span class="s2">"http://_gateway"</span><span class="p">)</span>
</code></pre>
<a name="Expected-Results"></a>
<h3 >Expected Results<a href="#Expected-Results" class="wiki-anchor">¶</a></h3>
<p>Both raise the same exception, or return the same URI object.</p>
<a name="Actual-Results"></a>
<h3 >Actual Results<a href="#Actual-Results" class="wiki-anchor">¶</a></h3>
<pre><code>URI::HTTP.build(host: "_gateway")
/usr/share/ruby/uri/generic.rb:601:in `check_host': bad component(expected host component): _gateway (URI::InvalidComponentError)
from /usr/share/ruby/uri/generic.rb:640:in `host='
from /usr/share/ruby/uri/generic.rb:673:in `hostname='
from /usr/share/ruby/uri/generic.rb:190:in `initialize'
from /usr/share/ruby/uri/generic.rb:136:in `new'
from /usr/share/ruby/uri/generic.rb:136:in `build'
from /usr/share/ruby/uri/http.rb:61:in `build'
from (irb):2:in `<main>'
from /usr/local/share/gems/gems/irb-1.7.0/exe/irb:9:in `<top (required)>'
from /usr/local/bin/irb:25:in `load'
from /usr/local/bin/irb:25:in `<main>'
</code></pre>
<pre><code>URI.parse("https://_gateway")
# => #<URI::HTTPS https://_gateway>
</code></pre>
<a name="Additional-Information"></a>
<h2 >Additional Information<a href="#Additional-Information" class="wiki-anchor">¶</a></h2>
<pre><code>$ gem list uri
uri (default: 0.12.1)
</code></pre> Ruby master - Bug #19716 (Open): SystemStackError occurs too easily on Alpine Linux (due to small...https://bugs.ruby-lang.org/issues/197162023-06-07T00:13:59Zalexdowad (Alex Dowad)alexinbeijing@gmail.com
<p>This is the same problem previously reported against Ruby 2.5 in <a href="https://bugs.ruby-lang.org/issues/14387" class="external">https://bugs.ruby-lang.org/issues/14387</a>. I just ran into the same problem on Ruby 3.1.4, built on Alpine Linux 3.16.</p>
<p><a class="user active user-mention" href="https://bugs.ruby-lang.org/users/572">@hsbt (Hiroshi SHIBATA)</a> stated in the previous thread (<a href="https://bugs.ruby-lang.org/issues/14387#note-28" class="external">https://bugs.ruby-lang.org/issues/14387#note-28</a>):</p>
<blockquote>
<p>If you have this issue with Ruby 3.2, please file it with another issue.</p>
</blockquote>
<p>I hacked <code>stack_check</code> in gc.c to print the values of <code>STACK_START</code> and <code>STACK_END</code> on stack overflow; on the Alpine 3.16 host where this problem just occurred, the values printed were:</p>
<blockquote>
<p>Start=0x7ffd0bf4f000, End=0x7ffd0bf32530</p>
</blockquote>
<p>...which shows that Ruby thinks the stack size is only 131072 bytes. On the other hand, <code>ulimit -s</code> shows a stack size limit of 8192kb.</p>
<p>This Ruby 3.1.4 was built from unmodified source code downloaded from <a href="https://cache.ruby-lang.org" class="external">https://cache.ruby-lang.org</a>; the build was configured using <code>CFLAGS='-march=native' ./configure --disable-install-doc</code>.</p>
<p>The invocation of Ruby which blew the stack was <code>bundle exec rake db:migrate</code>, on a mid-sized Rails project.</p>
<p>Regarding @ncopa's patch from <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: Ruby 2.5 を Alpine Linux で実行すると比較的浅めで SystemStackError 例外になる (Closed)" href="https://bugs.ruby-lang.org/issues/14387">#14387</a>, <a class="user active user-mention" href="https://bugs.ruby-lang.org/users/92">@wanabe (_ wanabe)</a> listed some things which should be done before it is merged into mainline Ruby:</p>
<blockquote>
<p>Okay, The patch needs one or more proofs of its behaviour, like that:</p>
<p>Original issue <a href="/issues/14387">[ruby-dev:50421]</a> has gone away.<br>
Standard test codes run well.<br>
test-all<br>
ruby/spec<br>
getrlimit works on some situations like:<br>
on single thread<br>
with multiple threads<br>
with RLIMIT_STACK environment variable<br>
getrlimit code of musl is implemented correctly as expected.<br>
(But It's doubtful whether it can be. I guess that a proof of code soundness is very difficult.)<br>
Some "real world" applications can work.<br>
I think it is better example that that application(s) can't work without the patch.</p>
</blockquote>
<p>I am happy to help cover some of these points if the Ruby development team is still interested in merging @ncopa's patch.</p> Ruby master - Bug #19703 (Open): text/binary mode of parent process fd is not properly inherited ...https://bugs.ruby-lang.org/issues/197032023-05-31T14:34:29ZYO4 (Yoshinao Muramatsu)
<p>Windows OS can't inherit parent process fds greater than 2, but C runtime library support this.<br>
<a href="https://learn.microsoft.com/en-us/cpp/c-runtime-library/spawn-wspawn-functions#environment-of-the-spawned-process" class="external">https://learn.microsoft.com/en-us/cpp/c-runtime-library/spawn-wspawn-functions#environment-of-the-spawned-process</a></p>
<p>So I made test tool below.<br>
This tool opens NUL device several times and create child ruby process that dumps fds' translation mode.</p>
<pre><code class="c syntaxhl" data-language="c"><span class="c1">// fdinherit.c : test file descprotor inheritance for windows C runtime</span>
<span class="cp">#include</span> <span class="cpf"><stdio.h></span><span class="cp">
#include</span> <span class="cpf"><stdlib.h></span><span class="cp">
#include</span> <span class="cpf"><process.h></span><span class="cp">
#include</span> <span class="cpf"><sys/types.h></span><span class="cp">
#include</span> <span class="cpf"><sys/stat.h></span><span class="cp">
#include</span> <span class="cpf"><share.h></span><span class="cp">
#include</span> <span class="cpf"><fcntl.h></span><span class="cp">
#include</span> <span class="cpf"><io.h></span><span class="cp">
</span>
<span class="kt">int</span> <span class="nf">main</span><span class="p">(</span><span class="kt">int</span> <span class="n">argc</span><span class="p">,</span> <span class="kt">char</span><span class="o">*</span> <span class="n">argv</span><span class="p">[])</span>
<span class="p">{</span>
<span class="kt">int</span> <span class="n">fh</span><span class="p">,</span> <span class="n">count</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
<span class="n">errno_t</span> <span class="n">err</span><span class="p">;</span>
<span class="c1">// child process: read fds and check if it includes "\r" and prints</span>
<span class="c1">// '.' : read as binary</span>
<span class="c1">// 't' : read as text</span>
<span class="c1">// 'F' : open error (no fd?)</span>
<span class="kt">char</span> <span class="n">rb1</span><span class="p">[]</span> <span class="o">=</span>
<span class="s">"print '012'; 3.upto("</span><span class="p">;</span> <span class="kt">char</span> <span class="n">rb2</span><span class="p">[]</span> <span class="o">=</span> <span class="s">") { |n|"</span>
<span class="s">"print ((IO.for_fd(n, 'rb').read.include?(13.chr) ? '.' : 't') rescue 'F');"</span>
<span class="s">"puts if (n % 10) == 9"</span>
<span class="s">"}"</span><span class="p">;</span>
<span class="kt">char</span> <span class="n">upto</span><span class="p">[]</span> <span class="o">=</span> <span class="s">"-4294967295"</span><span class="p">;</span>
<span class="c1">// fd max number to test</span>
<span class="k">if</span> <span class="p">(</span><span class="n">argc</span> <span class="o">>=</span> <span class="mi">2</span><span class="p">)</span> <span class="n">count</span> <span class="o">=</span> <span class="n">atoi</span><span class="p">(</span><span class="n">argv</span><span class="p">[</span><span class="mi">1</span><span class="p">]);</span>
<span class="k">if</span> <span class="p">(</span><span class="n">count</span> <span class="o"><</span> <span class="mi">3</span><span class="p">)</span> <span class="n">count</span> <span class="o">=</span> <span class="mi">7</span><span class="p">;</span>
<span class="c1">// create crlf file (current directory)</span>
<span class="n">system</span><span class="p">(</span><span class="s">"echo;>crlf.txt"</span><span class="p">);</span>
<span class="c1">// open fds to inherit</span>
<span class="c1">// even fds are text mode, odd fds are binary mode</span>
<span class="k">for</span> <span class="p">(</span><span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">3</span><span class="p">;</span> <span class="n">i</span> <span class="o"><=</span> <span class="n">count</span><span class="p">;</span> <span class="n">i</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>
<span class="n">err</span> <span class="o">=</span> <span class="n">_sopen_s</span><span class="p">(</span><span class="o">&</span><span class="n">fh</span><span class="p">,</span> <span class="s">"crlf.txt"</span><span class="p">,</span> <span class="n">_O_RDONLY</span> <span class="o">|</span> <span class="p">((</span><span class="n">i</span> <span class="o">&</span> <span class="mi">1</span><span class="p">)</span> <span class="o">?</span> <span class="n">_O_BINARY</span> <span class="o">:</span> <span class="n">_O_TEXT</span><span class="p">),</span> <span class="n">_SH_DENYNO</span><span class="p">,</span> <span class="n">_S_IREAD</span> <span class="o">|</span> <span class="n">_S_IWRITE</span><span class="p">);</span>
<span class="k">if</span> <span class="p">(</span><span class="n">err</span> <span class="o">></span> <span class="mi">0</span><span class="p">)</span> <span class="n">printf</span><span class="p">(</span><span class="s">"%d %d</span><span class="se">\n</span><span class="s">"</span><span class="p">,</span> <span class="n">err</span><span class="p">,</span> <span class="n">fh</span><span class="p">);</span>
<span class="p">}</span>
<span class="c1">// on child side, +1'd fd dump will fail (prints 'F')</span>
<span class="n">sprintf_s</span><span class="p">(</span><span class="n">upto</span><span class="p">,</span> <span class="k">sizeof</span><span class="p">(</span><span class="n">upto</span><span class="p">),</span> <span class="s">"%d"</span><span class="p">,</span> <span class="n">count</span> <span class="o">+</span> <span class="mi">1</span><span class="p">);</span>
<span class="c1">// on windows, arguments are joined into a string. so below has bad manners, but let me take a few corners.</span>
<span class="n">_spawnlp</span><span class="p">(</span><span class="n">_P_WAIT</span><span class="p">,</span> <span class="s">"ruby.exe"</span><span class="p">,</span> <span class="s">"ruby.exe"</span><span class="p">,</span> <span class="s">"-e"</span><span class="p">,</span> <span class="s">"</span><span class="se">\"</span><span class="s">"</span><span class="p">,</span> <span class="n">rb1</span><span class="p">,</span> <span class="n">upto</span><span class="p">,</span> <span class="n">rb2</span><span class="p">,</span> <span class="s">"</span><span class="se">\"</span><span class="s">"</span><span class="p">,</span> <span class="nb">NULL</span><span class="p">);</span>
<span class="n">_close</span><span class="p">(</span><span class="n">fh</span><span class="p">);</span>
<span class="p">}</span>
</code></pre>
<p>As an example, this would display something like this</p>
<pre><code>>fdinherit.exe
012.t.t.F
>fdinherit.exe 16
012.t.t.t.
t.t.t.tF
>
</code></pre>
<p>0,1,2 are stdin, stdout, stderr<br>
fds of 3,5,7,... are inherited as binary mode<br>
fds of 4,6,... are inherited as text mode</p>
<p>And I found a few things to point out.<br>
When I modify ruby part like "IO.for_fd(n, 'r')" / "IO.for_fd(n, 'rt')" / "IO.for_fd(n)",<br>
It get result like <code>012tttttF</code>, so translation mode are interprited wrong.<br>
The odd thing is that the conversion mode is interpreted as is when "IO.for_fd(n, 'rb')", which I think is the expected behavior when "IO.for_fd(n, 'r')".</p>
<p>This tool and ruby.exe each work with a combination of msvcrt 32/64bit and ucrt64, so the C runtime interface seems stable.<br>
My understanding is that MRI does not state that it supports inheritance of fds larger than 3 in windows, but it seems to work partially.<br>
Are there any chances for improvement?</p>
<p>For those who want to follow up: it seems that fds are not inherited via cmd.exe /c</p> Ruby master - Bug #19701 (Open): The rb_classext_t::classpath field is not marked for T_ICLASShttps://bugs.ruby-lang.org/issues/197012023-05-31T06:26:22Zwks (Kunshan Wang)
<p>I am hacking Ruby to dump information about some objects, and I found that the <code>rb_classext_t::classpath</code> field for <code>T_ICLASS</code> objects sometimes contains dangling references to dead objects.</p>
<p>The commit <a href="https://github.com/ruby/ruby/commit/081cc4eb283cb01ddffb364397e5175dbfacab66" class="external">https://github.com/ruby/ruby/commit/081cc4eb283cb01ddffb364397e5175dbfacab66</a> set the <code>classpath</code> field of <code>rb_mRubyVMFrozenCore</code> to a string "FrozenCore" so that it can be dumped using the <code>rb_dump_literal</code> function.</p>
<p>However, in <code>gc_mark_children</code>, if the <code>obj</code> is a <code>T_ICLASS</code>, the <code>RCLASS_EXT(obj)->classpath</code> will not be marked. As a result, if <code>rb_mRubyVMFrozenCore</code> is the only object that holds a reference to the string "FrozenCore", the string will be considered garbage and reclaimed during a GC, and the <code>classpath</code> will contain a dangling pointer.</p>
<p>There are two solutions to this problem. We can take <em>one</em> of the approaches below (not both).</p>
<ol>
<li>Let the GC mark the <code>classpath</code> field. I drafted a pull request here: <a href="https://github.com/ruby/ruby/pull/7875" class="external">https://github.com/ruby/ruby/pull/7875</a>
</li>
<li>Revert the commit <a href="https://github.com/ruby/ruby/commit/081cc4eb283cb01ddffb364397e5175dbfacab66" class="external">https://github.com/ruby/ruby/commit/081cc4eb283cb01ddffb364397e5175dbfacab66</a>
</li>
</ol>
<p>Marking the <code>classpath</code> field in GC will keep the <code>rb_dump_literal</code> function working. For debug purposes, we can also use that field to identify what object a given <code>T_ICLASS</code> is. Adding one marked field may make GC slower, but I don't think it will be observable because there are far less <code>T_ICLASS</code> objects than ordinary objects.</p>
<p>If we reverting the commit above, the <code>classpath</code> will always be blank for all <code>T_ICLASS</code> objects. (Question: How do we enforce it?) It will also save some memory by keeping less strings alive. However, currently, "FrozenCore" seems to be the only <code>T_OBJECT</code> that has its classpath set, and it may not result in significant memory saving. I don't know what purpose the <code>rb_dump_literal</code> function originally served. Maybe it is still important. Maybe it is safe to remove now.</p>
<p>Which of the two approaches should we take? It looks like each of them has its pros and cons.</p> Ruby master - Bug #19696 (Open): YJIT panicked - branch stubs should never enlarge brancheshttps://bugs.ruby-lang.org/issues/196962023-05-25T21:19:56Zwildmaples (Maple Ong)
<a name="Description"></a>
<h3 >Description<a href="#Description" class="wiki-anchor">¶</a></h3>
<p>We found this error on Rails CI with YJIT enabled. I'm not quite sure how to reproduce it since the error was intermittent.</p>
<p>I'm posting here to see if it is helpful or if anyone else has encountered this.</p>
<pre><code>thread '<unnamed>' panicked at 'branch stubs should never enlarge branches (start_addr: 0x7fa19e55cb99, old_size: 5, new_size: 14)', ./yjit/src/core.rs:1858:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
/var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:587: [BUG] YJIT panicked
ruby 3.2.2 (2023-03-30 revision e51014f9c0) +jemalloc +YJIT [x86_64-linux]
-- Control frame information -----------------------------------------------
c:0131 p:0008 s:0680 e:000679 METHOD /var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activerecord/lib/active_record/connection_adapters/abstract_a
c:0130 p:0004 s:0676 e:000675 BLOCK /var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activerecord/lib/active_record/connection_adapters/abstract/c
c:0129 p:0079 s:0673 e:000671 METHOD /var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activesupport/lib/active_support/callbacks.rb:107
c:0128 p:0009 s:0663 e:000662 METHOD /var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activesupport/lib/active_support/callbacks.rb:929
c:0127 p:0005 s:0658 e:000657 METHOD /var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activerecord/lib/active_record/connection_adapters/abstract/c
c:0126 p:0013 s:0653 e:000652 METHOD /var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activerecord/lib/active_record/connection_adapters/abstract/c
c:0125 p:0011 s:0648 e:000647 METHOD /var/www/components/rails-backports/lib/rails/backports/7.0/abstract_adapter_thread_local_by_default.rb:97
c:0124 p:0021 s:0642 e:000638 METHOD /var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activerecord/lib/active_record/connection_adapters/abstract/c
c:0123 p:0172 s:0635 e:000634 METHOD /var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activerecord/lib/active_record/connection_adapters/abstract/c
c:0122 p:0014 s:0625 e:000624 METHOD /var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activerecord/lib/active_record/connection_handling.rb:313
c:0121 p:0003 s:0621 e:000620 METHOD /var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activerecord/lib/active_record/connection_handling.rb:280
c:0120 p:0004 s:0617 e:000616 BLOCK /var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activerecord/lib/active_record/fixtures.rb:560
c:0119 p:0087 s:0614 E:000b90 METHOD /var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activerecord/lib/active_record/fixtures.rb:575
c:0118 p:0015 s:0601 e:000600 METHOD /var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activerecord/lib/active_record/test_fixtures.rb:275
c:0117 p:0104 s:0596 E:002188 METHOD /var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activerecord/lib/active_record/test_fixtures.rb:125
c:0116 p:0008 s:0591 e:000590 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/isolator-0.8.0/lib/isolator/railtie.rb:27
c:0115 p:0003 s:0586 e:000585 METHOD /var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activerecord/lib/active_record/test_fixtures.rb:10
c:0114 p:0009 s:0582 e:000581 METHOD /var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activesupport/lib/active_support/current_attributes/test_help
c:0113 p:0009 s:0578 e:000577 METHOD /var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activesupport/lib/active_support/execution_context/test_helpe
c:0112 p:0003 s:0574 e:000573 BLOCK /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-rails-6.0.2/lib/rspec/rails/adapters.rb:74 [FINISH]
c:0111 p:---- s:0570 e:000569 CFUNC :instance_exec
c:0110 p:0013 s:0565 e:000564 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457
c:0109 p:0010 s:0559 e:000558 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:390
c:0108 p:0009 s:0553 e:000552 BLOCK /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:628
c:0107 p:0018 s:0550 e:000549 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:352
c:0106 p:0004 s:0544 e:000543 BLOCK /var/www/packs/tax_predictions/spec/support/tax_predictions.rb:11
c:0105 p:0018 s:0541 e:000540 METHOD /var/www/packs/tax_predictions/app/services/tax_predictions/testing.rb:14
c:0104 p:0021 s:0536 e:000535 BLOCK /var/www/packs/tax_predictions/spec/support/tax_predictions.rb:10 [FINISH]
c:0103 p:---- s:0532 e:000531 CFUNC :instance_exec
c:0102 p:0013 s:0527 e:000526 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457
c:0101 p:0010 s:0521 e:000520 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:390
c:0100 p:0009 s:0515 e:000514 BLOCK /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:628
c:0099 p:0018 s:0512 e:000511 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:352
c:0098 p:0005 s:0506 e:000505 BLOCK /var/www/spec/support/initializers/system_exit.rb:14 [FINISH]
c:0097 p:---- s:0502 e:000501 CFUNC :instance_exec
c:0096 p:0013 s:0497 e:000496 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457
c:0095 p:0010 s:0491 e:000490 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:390
c:0094 p:0009 s:0485 e:000484 BLOCK /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:628
c:0093 p:0018 s:0482 e:000481 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:352
c:0092 p:0041 s:0476 e:000475 BLOCK /var/www/spec/support/initializers/sidekiq_batch_middleware.rb:17 [FINISH]
c:0091 p:---- s:0471 e:000470 CFUNC :instance_exec
c:0090 p:0013 s:0466 e:000465 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457
c:0089 p:0010 s:0460 e:000459 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:390
c:0088 p:0009 s:0454 e:000453 BLOCK /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:628
c:0087 p:0018 s:0451 e:000450 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:352
c:0086 p:0004 s:0445 e:000444 BLOCK /var/www/spec/support/initializers/sidekiq.rb:38
c:0085 p:0018 s:0442 e:000441 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/sidekiq-6.5.8/lib/sidekiq/testing.rb:16
c:0084 p:0009 s:0436 e:000435 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/sidekiq-6.5.8/lib/sidekiq/testing.rb:30
c:0083 p:0010 s:0431 e:000430 BLOCK /var/www/spec/support/initializers/sidekiq.rb:38 [FINISH]
c:0082 p:---- s:0427 e:000426 CFUNC :instance_exec
c:0081 p:0013 s:0422 e:000421 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457
c:0080 p:0010 s:0416 e:000415 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:390
c:0079 p:0009 s:0410 e:000409 BLOCK /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:628
c:0078 p:0018 s:0407 e:000406 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:352
c:0077 p:0025 s:0401 e:000400 BLOCK /var/www/spec/support/initializers/rake.rb:18 [FINISH]
c:0076 p:---- s:0397 e:000396 CFUNC :instance_exec
c:0075 p:0013 s:0392 e:000391 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457
c:0074 p:0010 s:0386 e:000385 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:390
c:0073 p:0009 s:0380 e:000379 BLOCK /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:628
c:0072 p:0018 s:0377 e:000376 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:352 [FINISH]
c:0071 p:---- s:0371 e:000370 IFUNC
c:0070 p:0116 s:0368 E:002008 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/prosopite-1.3.1/lib/prosopite.rb:49
c:0069 p:0023 s:0363 e:000362 BLOCK /var/www/spec/support/initializers/prosopite.rb:36 [FINISH]
c:0068 p:---- s:0359 e:000358 CFUNC :instance_exec
c:0067 p:0013 s:0354 e:000353 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457
c:0066 p:0010 s:0348 e:000347 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:390
c:0065 p:0009 s:0342 e:000341 BLOCK /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:628
c:0064 p:0018 s:0339 e:000338 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:352
c:0063 p:0023 s:0333 e:000332 BLOCK /var/www/spec/support/initializers/logged_examples.rb:8 [FINISH]
c:0062 p:---- s:0329 e:000328 CFUNC :instance_exec
c:0061 p:0013 s:0324 e:000323 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457
c:0060 p:0010 s:0318 e:000317 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:390
c:0059 p:0009 s:0312 e:000311 BLOCK /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:628
c:0058 p:0018 s:0309 e:000308 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:352
c:0057 p:0116 s:0303 e:000302 BLOCK /var/www/vendor/bundle/ruby/3.2.0/gems/knapsack_pro-3.11.0/lib/knapsack_pro/adapters/rspec_adapter.rb:72 [FINISH]
c:0056 p:---- s:0298 e:000297 CFUNC :instance_exec
c:0055 p:0013 s:0293 e:000292 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457
c:0054 p:0010 s:0287 e:000286 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:390
c:0053 p:0009 s:0281 e:000280 BLOCK /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:628
c:0052 p:0018 s:0278 e:000277 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:352
c:0051 p:0032 s:0272 e:000271 BLOCK /var/www/spec/support/initializers/flake_quarantine.rb:131 [FINISH]
c:0050 p:---- s:0268 e:000267 CFUNC :instance_exec
c:0049 p:0013 s:0263 e:000262 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457
c:0048 p:0010 s:0257 e:000256 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:390
c:0047 p:0009 s:0251 e:000250 BLOCK /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:628
c:0046 p:0018 s:0248 e:000247 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:352
c:0045 p:0020 s:0242 e:000241 BLOCK /var/www/vendor/bundle/ruby/3.2.0/gems/singed-0.2.1/lib/singed/rspec.rb:8 [FINISH]
c:0044 p:---- s:0238 e:000237 CFUNC :instance_exec
c:0043 p:0013 s:0233 e:000232 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457
c:0042 p:0010 s:0227 e:000226 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:390
c:0041 p:0009 s:0221 e:000220 BLOCK /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:628
c:0040 p:0018 s:0218 e:000217 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:352 [FINISH]
c:0039 p:---- s:0212 e:000211 IFUNC
c:0038 p:0007 s:0209 e:000208 METHOD /var/www/spec/support/lib/stream_interceptor.rb:38
c:0037 p:0007 s:0205 e:000204 BLOCK /var/www/spec/support/initializers/stream_interception.rb:10 [FINISH]
c:0036 p:---- s:0201 e:000200 CFUNC :instance_exec
c:0035 p:0013 s:0196 e:000195 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457
c:0034 p:0010 s:0190 e:000189 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:390
c:0033 p:0009 s:0184 e:000183 BLOCK /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:628
c:0032 p:0018 s:0181 e:000180 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:352
c:0031 p:0037 s:0175 E:0002c8 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:629
c:0030 p:0104 s:0168 E:000248 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:486
c:0029 p:0018 s:0161 E:0026e8 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:468
c:0028 p:0019 s:0156 E:002178 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:511
c:0027 p:0076 s:0151 E:000188 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:259
c:0026 p:0036 s:0144 e:000143 METHOD /var/www/components/flake_quarantine/lib/flake_quarantine/rspec/example.rb:11
c:0025 p:0037 s:0139 e:000138 BLOCK /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example_group.rb:646 [FINISH]
c:0024 p:---- s:0133 e:000132 CFUNC :map
c:0023 p:0011 s:0129 e:000128 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example_group.rb:642
c:0022 p:0052 s:0124 e:000123 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example_group.rb:607
c:0021 p:0006 s:0115 e:000114 BLOCK /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example_group.rb:608 [FINISH]
c:0020 p:---- s:0111 e:000110 CFUNC :map
c:0019 p:0065 s:0107 e:000106 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example_group.rb:608
c:0018 p:0006 s:0098 e:000097 BLOCK /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example_group.rb:608 [FINISH]
c:0017 p:---- s:0094 e:000093 CFUNC :map
c:0016 p:0065 s:0090 e:000089 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example_group.rb:608
c:0015 p:0007 s:0081 e:000080 BLOCK /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/runner.rb:121 [FINISH]
c:0014 p:---- s:0077 e:000076 CFUNC :map
c:0013 p:0030 s:0073 e:000072 BLOCK /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/runner.rb:121
c:0012 p:0026 s:0070 e:000069 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/configuration.rb:2070
c:0011 p:0007 s:0066 e:000065 BLOCK /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/runner.rb:116
c:0010 p:0009 s:0062 e:000061 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/reporter.rb:74
c:0009 p:0019 s:0057 e:000056 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/runner.rb:115
c:0008 p:0035 s:0050 e:000049 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/runner.rb:89
c:0007 p:0201 s:0044 e:000043 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/knapsack_pro-3.11.0/lib/knapsack_pro/runners/queue/rspec_runner.rb:93
c:0006 p:0161 s:0027 e:000026 METHOD /var/www/vendor/bundle/ruby/3.2.0/gems/knapsack_pro-3.11.0/lib/knapsack_pro/runners/queue/rspec_runner.rb:40
c:0005 p:0041 s:0019 E:000928 METHOD bin/rspec_runner:60
c:0004 p:0016 s:0014 e:000013 METHOD bin/rspec_runner:43
c:0003 p:0005 s:0010 e:000009 METHOD bin/rspec_runner:18
c:0002 p:0060 s:0006 e:000005 EVAL bin/rspec_runner:166 [FINISH]
c:0001 p:0000 s:0003 E:000c50 DUMMY [FINISH]
-- Ruby level backtrace information ----------------------------------------
bin/rspec_runner:166:in `<main>'
bin/rspec_runner:18:in `run'
bin/rspec_runner:43:in `run'
bin/rspec_runner:60:in `run_with_knapsack_pro'
/var/www/vendor/bundle/ruby/3.2.0/gems/knapsack_pro-3.11.0/lib/knapsack_pro/runners/queue/rspec_runner.rb:40:in `run'
/var/www/vendor/bundle/ruby/3.2.0/gems/knapsack_pro-3.11.0/lib/knapsack_pro/runners/queue/rspec_runner.rb:93:in `run_tests'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/runner.rb:89:in `run'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/runner.rb:115:in `run_specs'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/reporter.rb:74:in `report'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/runner.rb:116:in `block in run_specs'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/configuration.rb:2070:in `with_suite_hooks'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/runner.rb:121:in `block (2 levels) in run_specs'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/runner.rb:121:in `map'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/runner.rb:121:in `block (3 levels) in run_specs'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example_group.rb:608:in `run'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example_group.rb:608:in `map'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example_group.rb:608:in `block in run'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example_group.rb:608:in `run'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example_group.rb:608:in `map'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example_group.rb:608:in `block in run'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example_group.rb:607:in `run'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example_group.rb:642:in `run_examples'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example_group.rb:642:in `map'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example_group.rb:646:in `block in run_examples'
/var/www/components/flake_quarantine/lib/flake_quarantine/rspec/example.rb:11:in `run'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:259:in `run'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:511:in `with_around_and_singleton_context_hooks'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:468:in `with_around_example_hooks'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:486:in `run'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:629:in `run_around_example_hooks_for'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:352:in `call'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:628:in `block (2 levels) in run_around_example_hooks_for'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:390:in `execute_with'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457:in `instance_exec'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457:in `instance_exec'
/var/www/spec/support/initializers/stream_interception.rb:10:in `block (2 levels) in <top (required)>'
/var/www/spec/support/lib/stream_interceptor.rb:38:in `intercept'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:352:in `call'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:628:in `block (2 levels) in run_around_example_hooks_for'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:390:in `execute_with'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457:in `instance_exec'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457:in `instance_exec'
/var/www/vendor/bundle/ruby/3.2.0/gems/singed-0.2.1/lib/singed/rspec.rb:8:in `block (2 levels) in <main>'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:352:in `call'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:628:in `block (2 levels) in run_around_example_hooks_for'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:390:in `execute_with'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457:in `instance_exec'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457:in `instance_exec'
/var/www/spec/support/initializers/flake_quarantine.rb:131:in `block (2 levels) in <main>'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:352:in `call'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:628:in `block (2 levels) in run_around_example_hooks_for'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:390:in `execute_with'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457:in `instance_exec'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457:in `instance_exec'
/var/www/vendor/bundle/ruby/3.2.0/gems/knapsack_pro-3.11.0/lib/knapsack_pro/adapters/rspec_adapter.rb:72:in `block (2 levels) in bind_time_tracker'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:352:in `call'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:628:in `block (2 levels) in run_around_example_hooks_for'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:390:in `execute_with'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457:in `instance_exec'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457:in `instance_exec'
/var/www/spec/support/initializers/logged_examples.rb:8:in `block (2 levels) in <main>'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:352:in `call'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:628:in `block (2 levels) in run_around_example_hooks_for'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:390:in `execute_with'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457:in `instance_exec'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457:in `instance_exec'
/var/www/spec/support/initializers/prosopite.rb:36:in `block (2 levels) in <main>'
/var/www/vendor/bundle/ruby/3.2.0/gems/prosopite-1.3.1/lib/prosopite.rb:49:in `scan'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:352:in `call'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:628:in `block (2 levels) in run_around_example_hooks_for'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:390:in `execute_with'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457:in `instance_exec'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457:in `instance_exec'
/var/www/spec/support/initializers/rake.rb:18:in `block (2 levels) in <main>'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:352:in `call'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:628:in `block (2 levels) in run_around_example_hooks_for'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:390:in `execute_with'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457:in `instance_exec'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457:in `instance_exec'
/var/www/spec/support/initializers/sidekiq.rb:38:in `block (2 levels) in <main>'
/var/www/vendor/bundle/ruby/3.2.0/gems/sidekiq-6.5.8/lib/sidekiq/testing.rb:30:in `fake!'
/var/www/vendor/bundle/ruby/3.2.0/gems/sidekiq-6.5.8/lib/sidekiq/testing.rb:16:in `__set_test_mode'
/var/www/spec/support/initializers/sidekiq.rb:38:in `block (3 levels) in <main>'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:352:in `call'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:628:in `block (2 levels) in run_around_example_hooks_for'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:390:in `execute_with'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457:in `instance_exec'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457:in `instance_exec'
/var/www/spec/support/initializers/sidekiq_batch_middleware.rb:17:in `block (2 levels) in <main>'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:352:in `call'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:628:in `block (2 levels) in run_around_example_hooks_for'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:390:in `execute_with'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457:in `instance_exec'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457:in `instance_exec'
/var/www/spec/support/initializers/system_exit.rb:14:in `block (2 levels) in <main>'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:352:in `call'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:628:in `block (2 levels) in run_around_example_hooks_for'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:390:in `execute_with'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457:in `instance_exec'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457:in `instance_exec'
/var/www/packs/tax_predictions/spec/support/tax_predictions.rb:10:in `block (2 levels) in <main>'
/var/www/packs/tax_predictions/app/services/tax_predictions/testing.rb:14:in `recompute_on_fetch!'
/var/www/packs/tax_predictions/spec/support/tax_predictions.rb:11:in `block (3 levels) in <main>'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:352:in `call'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:628:in `block (2 levels) in run_around_example_hooks_for'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/hooks.rb:390:in `execute_with'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457:in `instance_exec'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-core-3.12.2/lib/rspec/core/example.rb:457:in `instance_exec'
/var/www/vendor/bundle/ruby/3.2.0/gems/rspec-rails-6.0.2/lib/rspec/rails/adapters.rb:74:in `block (2 levels) in <module:MinitestLifecycleAdapter>'
/var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activesupport/lib/active_support/execution_context/test_helper.rb:6:in `before_setup'
/var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activesupport/lib/active_support/current_attributes/test_helper.rb:6:in `before_setup'
/var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activerecord/lib/active_record/test_fixtures.rb:10:in `before_setup'
/var/www/vendor/bundle/ruby/3.2.0/gems/isolator-0.8.0/lib/isolator/railtie.rb:27:in `setup_fixtures'
/var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activerecord/lib/active_record/test_fixtures.rb:125:in `setup_fixtures'
/var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activerecord/lib/active_record/test_fixtures.rb:275:in `load_fixtures'
/var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activerecord/lib/active_record/fixtures.rb:575:in `create_fixtures'
/var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activerecord/lib/active_record/fixtures.rb:560:in `block in create_fixtures'
/var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activerecord/lib/active_record/connection_handling.rb:280:in `connection'
/var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activerecord/lib/active_record/connection_handling.rb:313:in `retrieve_connection'
/var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activerecord/lib/active_record/connection_adapters/abstract/connection_handler.rb:211:in `retrieve_connection'
/var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:181:in `connection'
/var/www/components/rails-backports/lib/rails/backports/7.0/abstract_adapter_thread_local_by_default.rb:97:in `checkout'
/var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:341:in `checkout'
/var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:704:in `checkout_and_verify'
/var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activesupport/lib/active_support/callbacks.rb:929:in `_run_checkout_callbacks'
/var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activesupport/lib/active_support/callbacks.rb:107:in `run_callbacks'
/var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:705:in `block in checkout_and_verify'
/var/www/vendor/bundle/ruby/3.2.0/bundler/gems/rails-c15ee6e7b506/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:587:in `verify!'
-- C level backtrace information -------------------------------------------
/usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/libruby.so.3.2(rb_vm_bugreport+0xb2b) [0x7fa19a87c18b]
/usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/libruby.so.3.2(rb_bug_without_die+0x77) [0x7fa19a675937]
/usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/libruby.so.3.2(rb_bug+0x9f) [0x7fa19a5d0cd2]
/usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/libruby.so.3.2(_ZN4yjit4yjit17rb_bug_panic_hook28_$u7b$$u7b$closure$u7d$$u7d$17hfc31c2f18ccadc75E.llvm.12746241947442316067+0x5a) [0x7fa19a8b8d7a]
/usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/libruby.so.3.2(_ZN3std9panicking20rust_panic_with_hook17h66309baf5235212fE+0x3d3) [0x7fa19a8c9d73]
/usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/libruby.so.3.2(_ZN3std9panicking19begin_panic_handler28_$u7b$$u7b$closure$u7d$$u7d$17h3a147548aa082356E+0xb7) [0x7fa19a8ecb17]
/usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/libruby.so.3.2(_ZN3std10sys_common9backtrace26__rust_end_short_backtrace17hcc62583c733bef84E+0x14) [0x7fa19a8ec824]
/usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/libruby.so.3.2(rust_begin_unwind+0x42) [0x7fa19a8c9772]
/usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/libruby.so.3.2(_ZN4core9panicking9panic_fmt17h8531284c14f462dcE+0x33) [0x7fa19a5d8823]
/usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/libruby.so.3.2(_ZN4yjit4core20branch_stub_hit_body17h45fd758b20fb7aa6E+0xa03) [0x7fa19a89add3]
/usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/libruby.so.3.2(_ZN4yjit5cruby12with_vm_lock17h09508b1ca41af130E+0x49) [0x7fa19a8936b9]
/usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/libruby.so.3.2(_ZN4yjit4core15branch_stub_hit17h5cf8bd0b5727e3b9E.llvm.7796580109460741199+0x71) [0x7fa19a89ea31]
[0x7fa19b08501f]
-- Other runtime information -----------------------------------------------
* Loaded script: bin/rspec_runner
* Loaded features:
0 enumerator.so
1 thread.rb
2 fiber.so
3 rational.so
4 complex.so
5 ruby2_keywords.rb
6 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/x86_64-linux/enc/encdb.so
7 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/x86_64-linux/enc/trans/transdb.so
8 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/x86_64-linux/rbconfig.rb
9 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/rubygems/compatibility.rb
10 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/rubygems/defaults.rb
11 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/rubygems/deprecate.rb
12 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/rubygems/errors.rb
13 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/rubygems/unknown_command_spell_checker.rb
14 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/rubygems/exceptions.rb
15 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/rubygems/basic_specification.rb
16 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/rubygems/stub_specification.rb
17 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/rubygems/platform.rb
18 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/rubygems/util/list.rb
19 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/rubygems/version.rb
20 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/rubygems/requirement.rb
21 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/rubygems/specification.rb
22 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/rubygems/util.rb
23 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/rubygems/dependency.rb
24 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/rubygems/core_ext/kernel_gem.rb
25 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/x86_64-linux/monitor.so
26 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/monitor.rb
27 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/rubygems.rb
28 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/rubygems/path_support.rb
29 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/error_highlight/version.rb
30 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/error_highlight/base.rb
31 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/error_highlight/formatter.rb
32 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/error_highlight/core_ext.rb
33 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/error_highlight.rb
34 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/did_you_mean/version.rb
35 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/did_you_mean/core_ext/name_error.rb
36 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/did_you_mean/levenshtein.rb
37 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/did_you_mean/jaro_winkler.rb
38 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/did_you_mean/spell_checker.rb
39 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/did_you_mean/spell_checkers/name_error_checkers/class_name_checker.rb
40 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/did_you_mean/spell_checkers/name_error_checkers/variable_name_checker.rb
41 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/did_you_mean/spell_checkers/name_error_checkers.rb
42 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/did_you_mean/spell_checkers/method_name_checker.rb
43 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/did_you_mean/spell_checkers/key_error_checker.rb
44 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/did_you_mean/spell_checkers/null_checker.rb
45 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/did_you_mean/tree_spell_checker.rb
46 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/did_you_mean/spell_checkers/require_path_checker.rb
47 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/did_you_mean/spell_checkers/pattern_key_name_checker.rb
48 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/did_you_mean/formatter.rb
49 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/did_you_mean.rb
50 /usr/lib/fullstaq-ruby/versions/3.2.2-jemalloc/lib/ruby/3.2.0/syntax_suggest/core_ext.rb
</code></pre> Ruby master - Bug #19636 (Open): String#encode EUC_JIS_2004で"¥"がEncoding::UndefinedConversionErro...https://bugs.ruby-lang.org/issues/196362023-05-10T05:16:30Zsagittalplane (sagital plane)
<p>既知のバグでしたらすみません。</p>
<p>EUC-JIS-2004はJIS X 0213の実装なので"¥"は含まれているはずですがEncoding::UndefinedConversionErrorになります。</p>
<p><a href="https://ja.wikipedia.org/wiki/EUC-JIS-2004" class="external">https://ja.wikipedia.org/wiki/EUC-JIS-2004</a><br>
<a href="https://ja.wikipedia.org/wiki/JIS_X_0213%E9%9D%9E%E6%BC%A2%E5%AD%97%E4%B8%80%E8%A6%A7" class="external">https://ja.wikipedia.org/wiki/JIS_X_0213%E9%9D%9E%E6%BC%A2%E5%AD%97%E4%B8%80%E8%A6%A7</a></p>
<p>リファレンスマニュアルにも特にないようなのでバグのように見えます。<br>
<a href="https://docs.ruby-lang.org/ja/latest/class/String.html#I_ENCODE" class="external">https://docs.ruby-lang.org/ja/latest/class/String.html#I_ENCODE</a></p>
<pre><code>root@d8c36610327f:/opt/app# ruby -v
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-linux]
root@d8c36610327f:/opt/app# ruby -e '"¥".encode(Encoding::EUC_JIS_2004)'
-e:1:in `encode': U+00A5 from UTF-8 to EUC-JIS-2004 (Encoding::UndefinedConversionError)
from -e:1:in `<main>'
root@d8c36610327f:/opt/app#
</code></pre> Ruby master - Bug #19562 (Open): Setting default_(in|ex)ternal encoding after running an Ractor f...https://bugs.ruby-lang.org/issues/195622023-03-30T13:19:54Zlarskanis (Lars Kanis)
<p>The following command blocks infinitely and must be killed with "kill -9"</p>
<pre><code>ruby -e "Ractor.new{}.take; Encoding.default_external = Encoding::ISO8859_2"
</code></pre>
<p>Backtrace is:</p>
<pre><code>#0 futex_wait (private=0, expected=2, futex_word=0x55555555abd0) at ../sysdeps/nptl/futex-internal.h:146
#1 __GI___lll_lock_wait (futex=futex@entry=0x55555555abd0, private=0) at ./nptl/lowlevellock.c:49
#2 0x00007ffff760a082 in lll_mutex_lock_optimized (mutex=0x55555555abd0) at ./nptl/pthread_mutex_lock.c:48
#3 ___pthread_mutex_lock (mutex=mutex@entry=0x55555555abd0) at ./nptl/pthread_mutex_lock.c:93
#4 0x00007ffff7c5a40d in rb_native_mutex_lock (lock=lock@entry=0x55555555abd0) at ruby-3.2.1/thread_pthread.c:556
#5 0x00007ffff7cc5376 in vm_lock_enter (cr=0x55555555deb0, vm=0x55555555aba0, locked=locked@entry=false, no_barrier=no_barrier@entry=false, lev=0x55555555ac00) at vm_sync.c:56
#6 0x00007ffff7cc5747 in rb_vm_lock_body () at vm_sync.c:175
#7 0x00007ffff7bc02c2 in rb_vm_lock (line=1829, file=0x7ffff7e209cb "ractor.c") at ruby-3.2.1/vm_sync.h:57
#8 ractor_check_blocking (remained_thread_cnt=<optimized out>, file=0x7ffff7e209cb "ractor.c", line=1865, cr=0x55555555deb0) at ractor.c:1829
#9 ractor_check_blocking (line=1865, file=0x7ffff7e209cb "ractor.c", remained_thread_cnt=<optimized out>, cr=0x55555555deb0) at ractor.c:1811
#10 rb_ractor_blocking_threads_inc (cr=0x55555555deb0, file=file@entry=0x7ffff7e29b04 "thread.c", line=line@entry=1488) at ractor.c:1865
#11 0x00007ffff7c60977 in blocking_region_begin (th=0x55555555d070, region=0x7fffffffd220, ubf=0x7ffff7c5b300 <ubf_select>, arg=0x55555555d070, fail_if_interrupted=<optimized out>) at thread.c:1488
#12 0x00007ffff7c61edf in rb_nogvl (func=0x7ffff7ac66e0 <no_gvl_stat>, data1=0x7fffffffd2a0, ubf=<optimized out>, data2=0x55555555d070, flags=<optimized out>) at thread.c:1548
#13 0x00007ffff7acdfbc in stat_without_gvl (st=0x7fffffffd2b0, path=0x7ffff27dfe88 "ruby-3.2.1/lib/ruby/3.2.0/x86_64-linux/enc/iso_8859_2.so") at file.c:1171
#14 rb_check_realpath_internal (basedir=basedir@entry=4, path=path@entry=140737261984200, origenc=0x555555565030, mode=mode@entry=RB_REALPATH_STRICT) at file.c:4491
#15 0x00007ffff7acebaa in rb_realpath_internal (basedir=basedir@entry=4, path=path@entry=140737261984200, strict=strict@entry=1) at file.c:4536
#16 0x00007ffff7b2cdd4 in require_internal (ec=0x55555555e1f0, fname=<optimized out>, exception=1, warn=<optimized out>) at load.c:1195
#17 0x00007ffff7aa0a17 in load_encoding (name=0x5555556049b0 "ISO-8859-2") at encoding.c:779
#18 0x00007ffff7aa2ef8 in check_encoding (enc=0x5555556049d0) at encoding.c:191
#19 enc_check_encoding (obj=140737335533800) at encoding.c:202
#20 rb_to_encoding (enc=enc@entry=140737335533800) at encoding.c:307
#21 0x00007ffff7aa4049 in enc_set_default_encoding (name=0x7ffff7de6287 "external", encoding=140737335533800, def=0x7ffff7fb00c0 <default_external>) at encoding.c:1563
#22 rb_enc_set_default_external (encoding=140737335533800) at encoding.c:1637
#23 0x00007ffff7aa411f in set_default_external (klass=<optimized out>, encoding=140737335533800) at encoding.c:1658
#24 0x00007ffff7c99037 in vm_call_cfunc_with_frame (ec=0x55555555e1f0, reg_cfp=0x7ffff6f7df90, calling=<optimized out>) at ruby-3.2.1/vm_insnhelper.c:3268
#25 0x00007ffff7ca9564 in vm_sendish (method_explorer=<optimized out>, block_handler=<optimized out>, cd=<optimized out>, reg_cfp=<optimized out>, ec=<optimized out>)
at ruby-3.2.1/vm_callinfo.h:367
#26 vm_exec_core (ec=0x55555555e1f0, initial=128) at ruby-3.2.1/insns.def:820
#27 0x00007ffff7caee93 in rb_vm_exec (ec=0x55555555e1f0, jit_enable_p=true) at vm.c:2374
#28 0x00007ffff7abfbf1 in rb_ec_exec_node (ec=ec@entry=0x55555555e1f0, n=n@entry=0x7ffff796c2c0) at eval.c:289
#29 0x00007ffff7ac60b3 in ruby_run_node (n=0x7ffff796c2c0) at eval.c:330
#30 0x0000555555555187 in rb_main (argv=0x7fffffffdb98, argc=3) at ./main.c:38
#31 main (argc=<optimized out>, argv=<optimized out>) at ./main.c:57
</code></pre>
<p>When the encoding was already loaded before running <code>Ractor.new</code>, then it works and doesn't block:</p>
<pre><code>ruby -e "''.encode(Encoding::ISO8859_2); Ractor.new{}.take; Encoding.default_internal = Encoding::ISO8859_2"
</code></pre>
<p>When the encoding is not assigned as default encoding, but used otherwise, it works too:</p>
<pre><code>ruby -e "Ractor.new{}.take; ''.encode(Encoding::ISO8859_2)"
</code></pre> Ruby master - Bug #19558 (Open): str.dump.undump crashes when str contains both Unicode and ASCII...https://bugs.ruby-lang.org/issues/195582023-03-29T13:47:47Zikaronen-relex (Ilmari Karonen)
<p>Recently, as a result of a question I asked on Stack Overflow (<a href="https://stackoverflow.com/q/75866159" class="external">https://stackoverflow.com/q/75866159</a>), I learned about the existence of String#dump and String#undump. However, I also found what seems like a bug in them, in that apparently dumping and then undumping a string containing a sufficiently diverse selection of characters (such as at least one ASCII C0 control character and at least one non-ASCII Unicode character) causes the undump to raise a RuntimeError.</p>
<p>Specifically, evaluating e.g. any of the following expressions:</p>
<pre><code>"\u0000\uFFFF".dump.undump
"\u0001\uABCD".dump.undump
"\u007F\u0080".dump.undump
</code></pre>
<p>raises a RuntimeError with the message "hex escape and Unicode escape are mixed". This contradicts the documentation of String#undump, which says that it "does the inverse of String#dump."</p>
<p>The behavior is the same on all Ruby versions I have tested this on, including master (3.3.0), 2.6.10 and JRuby 9.3.10.0.</p>
<p>The obvious fix would be to simply remove the check for mixed hex and Unicode escape sequences, essentially reverting <a href="https://github.com/ruby/ruby/commit/05d1d29d1f4a87620371463d8c7942e170be031f" class="external">https://github.com/ruby/ruby/commit/05d1d29d1f4a87620371463d8c7942e170be031f</a>. However, as I don't understand why the check is there in the first place, I'm also not sure if removing it could somehow have some unwanted consequences.</p> Ruby master - Bug #19438 (Open): Ruby 2.7 -> 3.2 Performance Regression in so_k_nucleotide benchmarkhttps://bugs.ruby-lang.org/issues/194382023-02-15T13:30:14Znick.schwaderer (Nicholas Schwaderer)nicholas.schwaderer@gmail.com
<a name="Introduction"></a>
<h2 >Introduction<a href="#Introduction" class="wiki-anchor">¶</a></h2>
<p>Recently I had been going through some of the old benchmarks in the <a href="https://programmingzen.com/the-great-ruby-shootout-july-2010/" class="external">Ruby Great Implementation Shootout</a> from around 2010.</p>
<p>As an experiment, one night I ran the benchmarks against Ruby 3.2.0, Ruby 3.2.0 --yjit, TruffleRuby, TruffleRuby +GraalVM, and Ruby 2.6.10.</p>
<p>Most results were as expected. However there was a benchmark that Ruby 2.6.10 was <em>consistently</em> outperforming all new Rubies on.</p>
<a name="Method"></a>
<h2 >Method<a href="#Method" class="wiki-anchor">¶</a></h2>
<p>After pairing with <a class="user active user-mention" href="https://bugs.ruby-lang.org/users/31800">@eightbitraptor (Matthew Valentine-House)</a>, we discovered that this old benchmark was remarkably similar to an existing benchmark in the <code>/benchmark</code><br>
directory, <a href="https://github.com/ruby/ruby/blob/master/benchmark/so_k_nucleotide.yml" class="external">so_k_nucleotide.yml</a>. We decided to go with that benchmark. For brevity I have not included the full 150 lines of the benchmark here.</p>
<p>I tested this benchmark out with 100 runs using <code>benchmark-driver</code> against Ruby 2.7,3.0,3.1,3.2. (I had discovered that 2.7 was even faster than 2.6.).</p>
<p>It appears that about half of the regression occured from 2.7 -> 3.0; the other half from 3.0 -> 3.2. One other interesting finding is that each minor version does appear to regress<br>
from the last, even if a little.</p>
<a name="Code"></a>
<h2 >Code<a href="#Code" class="wiki-anchor">¶</a></h2>
<p>This is my benchmark running code and harnass. <a href="https://gist.github.com/Schwad/16edf3d7cc5316af4baf23497f3c6a8f" class="external">The full code and data can be found here</a></p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="no">RUNS</span> <span class="o">=</span> <span class="mi">100</span>
<span class="n">results</span> <span class="o">=</span> <span class="no">Hash</span><span class="p">.</span><span class="nf">new</span> <span class="p">{</span> <span class="o">|</span><span class="n">h</span><span class="p">,</span> <span class="n">k</span><span class="o">|</span> <span class="n">h</span><span class="p">[</span><span class="n">k</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span> <span class="p">}</span>
<span class="no">RUNS</span><span class="p">.</span><span class="nf">times</span> <span class="k">do</span> <span class="o">|</span><span class="n">i</span><span class="o">|</span>
<span class="nb">puts</span> <span class="n">i</span>
<span class="n">run</span> <span class="o">=</span> <span class="sb">`benchmark-driver so_k_nucleotide.yml --chruby '2.7.5;3.0.5;3.1.3;3.2.0' -o simple`</span>
<span class="n">run</span><span class="p">.</span><span class="nf">scan</span><span class="p">(</span><span class="sr">/\d\.\d\.\d/</span><span class="p">).</span><span class="nf">each_with_index</span> <span class="k">do</span> <span class="o">|</span><span class="n">version</span><span class="p">,</span> <span class="n">index</span><span class="o">|</span>
<span class="n">results</span><span class="p">[</span><span class="n">version</span><span class="p">]</span> <span class="o"><<</span> <span class="n">run</span><span class="p">.</span><span class="nf">scan</span><span class="p">(</span><span class="sr">/\d\.\d\d\d/</span><span class="p">)[</span><span class="n">index</span><span class="p">]</span>
<span class="k">end</span>
<span class="k">end</span>
<span class="nb">require</span> <span class="s1">'csv'</span>
<span class="n">columns</span> <span class="o">=</span> <span class="n">results</span><span class="p">.</span><span class="nf">keys</span>
<span class="n">outdata</span> <span class="o">=</span> <span class="no">CSV</span><span class="p">.</span><span class="nf">generate</span> <span class="k">do</span> <span class="o">|</span><span class="n">csv</span><span class="o">|</span>
<span class="n">csv</span> <span class="o"><<</span> <span class="n">columns</span>
<span class="no">RUNS</span><span class="p">.</span><span class="nf">times</span> <span class="k">do</span> <span class="o">|</span><span class="n">i</span><span class="o">|</span>
<span class="n">csv</span> <span class="o"><<</span> <span class="n">columns</span><span class="p">.</span><span class="nf">map</span> <span class="p">{</span> <span class="o">|</span><span class="n">c</span><span class="o">|</span> <span class="n">results</span><span class="p">[</span><span class="n">c</span><span class="p">][</span><span class="n">i</span><span class="p">]</span> <span class="p">}</span>
<span class="k">end</span>
<span class="k">end</span>
<span class="no">File</span><span class="p">.</span><span class="nf">write</span><span class="p">(</span><span class="s2">"output.csv"</span><span class="p">,</span> <span class="n">outdata</span><span class="p">)</span>
</code></pre>
<a name="Data"></a>
<h2 >Data<a href="#Data" class="wiki-anchor">¶</a></h2>
<p>Ruby 2.7.5 was consistently ~18-20% faster than Ruby 3.2.0 in this Benchmark</p>
<p><img src="https://user-images.githubusercontent.com/7865030/219038430-4a124cc6-0d23-46e2-9794-d89d1f26e227.png" alt="Screenshot 2023-02-15 at 13 16 10"></p>
<a name="Next-Steps"></a>
<h2 >Next Steps<a href="#Next-Steps" class="wiki-anchor">¶</a></h2>
<p>I am happy to help investigate or learn more about this regression if anyone has any ideas.</p> Ruby master - Bug #19412 (Open): Socket starts queueing and not responding after a certain amount...https://bugs.ruby-lang.org/issues/194122023-02-03T23:44:54Zbrodock (Gabriel Mazetto)brodock@gmail.com
<p>Here is a an example code:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="nb">require</span> <span class="s1">'socket'</span>
<span class="no">PORT</span> <span class="o">=</span> <span class="mi">8080</span>
<span class="no">BACKLOG</span> <span class="o">=</span> <span class="mi">50</span>
<span class="no">LISTEN</span> <span class="o">=</span> <span class="s1">'127.0.0.1'</span>
<span class="k">def</span> <span class="nf">handle_connection</span><span class="p">(</span><span class="n">connection</span><span class="p">,</span> <span class="n">_addrinfo</span><span class="p">)</span>
<span class="n">request</span> <span class="o">=</span> <span class="n">connection</span><span class="p">.</span><span class="nf">gets</span>
<span class="nb">puts</span> <span class="n">request</span>
<span class="n">connection</span><span class="p">.</span><span class="nf">write</span> <span class="s2">"HTTP/1.1 200</span><span class="se">\r\n</span><span class="s2">"</span>
<span class="n">connection</span><span class="p">.</span><span class="nf">write</span> <span class="s2">"Content-Type: text/html</span><span class="se">\r\n</span><span class="s2">"</span>
<span class="n">connection</span><span class="p">.</span><span class="nf">write</span> <span class="s2">"</span><span class="se">\r\n</span><span class="s2">"</span>
<span class="n">connection</span><span class="p">.</span><span class="nf">write</span> <span class="s2">"Hello world! Current time is </span><span class="si">#{</span><span class="no">Time</span><span class="p">.</span><span class="nf">now</span><span class="si">}</span><span class="s2">"</span>
<span class="k">ensure</span>
<span class="n">connection</span><span class="p">.</span><span class="nf">close</span>
<span class="k">end</span>
<span class="k">begin</span>
<span class="n">socket</span> <span class="o">=</span> <span class="no">Socket</span><span class="p">.</span><span class="nf">new</span><span class="p">(</span><span class="ss">:INET</span><span class="p">,</span> <span class="ss">:STREAM</span><span class="p">)</span>
<span class="n">socket</span><span class="p">.</span><span class="nf">bind</span><span class="p">(</span><span class="no">Addrinfo</span><span class="p">.</span><span class="nf">tcp</span><span class="p">(</span><span class="no">LISTEN</span><span class="p">,</span> <span class="no">PORT</span><span class="p">))</span>
<span class="n">socket</span><span class="p">.</span><span class="nf">listen</span><span class="p">(</span><span class="no">BACKLOG</span><span class="p">)</span>
<span class="nb">puts</span> <span class="s2">"Requested queue size: </span><span class="si">#{</span><span class="no">BACKLOG</span><span class="si">}</span><span class="s2"> bigger then limit: </span><span class="si">#{</span><span class="no">Socket</span><span class="o">::</span><span class="no">SOMAXCONN</span><span class="si">}</span><span class="s2">"</span> <span class="k">if</span> <span class="no">BACKLOG</span> <span class="o">></span> <span class="no">Socket</span><span class="o">::</span><span class="no">SOMAXCONN</span>
<span class="kp">loop</span> <span class="k">do</span>
<span class="n">listening</span><span class="p">,</span> <span class="o">=</span> <span class="no">IO</span><span class="p">.</span><span class="nf">select</span><span class="p">([</span><span class="n">socket</span><span class="p">])</span>
<span class="n">io</span><span class="p">,</span> <span class="o">=</span> <span class="n">listening</span>
<span class="n">connection</span><span class="p">,</span> <span class="n">addrinfo</span> <span class="o">=</span> <span class="n">io</span><span class="p">.</span><span class="nf">accept</span>
<span class="n">handle_connection</span><span class="p">(</span><span class="n">connection</span><span class="p">,</span> <span class="n">addrinfo</span><span class="p">)</span>
<span class="k">end</span>
<span class="k">ensure</span>
<span class="n">socket</span><span class="p">.</span><span class="nf">close</span>
<span class="k">end</span>
</code></pre>
<p>This tries to simulate a TCP server that responds as if it was an HTTP server.</p>
<p>The amount of requests it can sustain seems to depend on the OS. On a Linux machine running ubuntu 20.04 I get something around 7.6K to 7.8K until it stops responding.</p>
<pre><code>$ uname -a
Linux ... 5.17.5-x86_64-linode154 #1 SMP PREEMPT Mon May 2 15:07:22 EDT 2022 x86_64 x86_64 x86_64 GNU/Linux
$ ab -n 20000 -c 50 http://127.0.0.1:8080/
This is ApacheBench, Version 2.3 <$Revision: 1843412 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)
Completed 2000 requests
Completed 4000 requests
Completed 6000 requests
apr_pollset_poll: The timeout specified has expired (70007)
Total of 7883 requests completed
</code></pre>
<p>on MacOS Ventura I get around 16K:</p>
<pre><code>$ uname -a
Darwin ... 22.2.0 Darwin Kernel Version 22.2.0: Fri Nov 11 02:04:44 PST 2022; root:xnu-8792.61.2~4/RELEASE_ARM64_T8103 arm64
$ ab -n 20000 -c 50 http://127.0.0.1:8080/
This is ApacheBench, Version 2.3 <$Revision: 1901567 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)
Completed 2000 requests
Completed 4000 requests
Completed 6000 requests
Completed 8000 requests
Completed 10000 requests
Completed 12000 requests
Completed 14000 requests
Completed 16000 requests
apr_socket_recv: Operation timed out (60)
Total of 16375 requests completed
</code></pre>
<p>in both cases when that limit reaches, if I abort the program (CTRL-C) and try to run it again it takes a while until the port is released:</p>
<pre><code>...
GET / HTTP/1.0
GET / HTTP/1.0
GET / HTTP/1.0
^Csocketserver.rb:29:in `select': Interrupt
from socketserver.rb:29:in `block in <main>'
from socketserver.rb:28:in `loop'
from socketserver.rb:28:in `<main>'
$ ruby socketserver.rb
socketserver.rb:23:in `bind': Address already in use - bind(2) for 127.0.0.1:8080 (Errno::EADDRINUSE)
from socketserver.rb:23:in `<main>'
</code></pre>
<p>After killing the process it seems no process is holding the port:</p>
<pre><code>lsof -wni tcp:8080
</code></pre>
<p>Running the command above does not return anything (it does when the program is still running).</p>
<p>I think we may be failing to release something when interacting with the Socket on syscalls/kernel level and we endup filling up some queue/buffer that eventually gets freed.</p> Ruby master - Bug #19288 (Open): Ractor JSON parsing significantly slower than linear parsinghttps://bugs.ruby-lang.org/issues/192882022-12-30T10:39:56Zmaciej.mensfeld (Maciej Mensfeld)maciej@mensfeld.pl
<p>a simple benchmark:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="nb">require</span> <span class="s1">'json'</span>
<span class="nb">require</span> <span class="s1">'benchmark'</span>
<span class="no">CONCURRENT</span> <span class="o">=</span> <span class="mi">5</span>
<span class="no">RACTORS</span> <span class="o">=</span> <span class="kp">true</span>
<span class="no">ELEMENTS</span> <span class="o">=</span> <span class="mi">100_000</span>
<span class="n">data</span> <span class="o">=</span> <span class="no">CONCURRENT</span><span class="p">.</span><span class="nf">times</span><span class="p">.</span><span class="nf">map</span> <span class="k">do</span>
<span class="no">ELEMENTS</span><span class="p">.</span><span class="nf">times</span><span class="p">.</span><span class="nf">map</span> <span class="k">do</span>
<span class="p">{</span>
<span class="nb">rand</span> <span class="o">=></span> <span class="nb">rand</span><span class="p">,</span>
<span class="nb">rand</span> <span class="o">=></span> <span class="nb">rand</span><span class="p">,</span>
<span class="nb">rand</span> <span class="o">=></span> <span class="nb">rand</span><span class="p">,</span>
<span class="nb">rand</span> <span class="o">=></span> <span class="nb">rand</span>
<span class="p">}.</span><span class="nf">to_json</span>
<span class="k">end</span>
<span class="k">end</span>
<span class="n">ractors</span> <span class="o">=</span> <span class="no">CONCURRENT</span><span class="p">.</span><span class="nf">times</span><span class="p">.</span><span class="nf">map</span> <span class="k">do</span>
<span class="no">Ractor</span><span class="p">.</span><span class="nf">new</span> <span class="k">do</span>
<span class="no">Ractor</span><span class="p">.</span><span class="nf">receive</span><span class="p">.</span><span class="nf">each</span> <span class="p">{</span> <span class="no">JSON</span><span class="p">.</span><span class="nf">parse</span><span class="p">(</span><span class="n">_1</span><span class="p">)</span> <span class="p">}</span>
<span class="k">end</span>
<span class="k">end</span>
<span class="n">result</span> <span class="o">=</span> <span class="no">Benchmark</span><span class="p">.</span><span class="nf">measure</span> <span class="k">do</span>
<span class="k">if</span> <span class="no">RACTORS</span>
<span class="no">CONCURRENT</span><span class="p">.</span><span class="nf">times</span> <span class="k">do</span> <span class="o">|</span><span class="n">i</span><span class="o">|</span>
<span class="n">ractors</span><span class="p">[</span><span class="n">i</span><span class="p">].</span><span class="nf">send</span><span class="p">(</span><span class="n">data</span><span class="p">[</span><span class="n">i</span><span class="p">],</span> <span class="ss">move: </span><span class="kp">false</span><span class="p">)</span>
<span class="k">end</span>
<span class="n">ractors</span><span class="p">.</span><span class="nf">each</span><span class="p">(</span><span class="o">&</span><span class="ss">:take</span><span class="p">)</span>
<span class="k">else</span>
<span class="c1"># Linear without any threads</span>
<span class="n">data</span><span class="p">.</span><span class="nf">each</span> <span class="k">do</span> <span class="o">|</span><span class="n">piece</span><span class="o">|</span>
<span class="n">piece</span><span class="p">.</span><span class="nf">each</span> <span class="p">{</span> <span class="no">JSON</span><span class="p">.</span><span class="nf">parse</span><span class="p">(</span><span class="n">_1</span><span class="p">)</span> <span class="p">}</span>
<span class="k">end</span>
<span class="k">end</span>
<span class="k">end</span>
<span class="nb">puts</span> <span class="n">result</span>
</code></pre>
<p>Gives following results on my 8 core machine:</p>
<pre><code class="shell syntaxhl" data-language="shell"><span class="c"># without ractors:</span>
2.731748 0.003993 2.735741 <span class="o">(</span> 2.736349<span class="o">)</span>
<span class="c"># with ractors</span>
12.580452 5.089802 17.670254 <span class="o">(</span> 5.209755<span class="o">)</span>
</code></pre>
<p>I would expect Ractors not to be two times slower on the CPU intense work.</p> Ruby master - Bug #19266 (Open): URI::Generic should use URI::RFC3986_PARSER instead of URI::DEFA...https://bugs.ruby-lang.org/issues/192662022-12-26T18:52:36Zgareth (Gareth Adams)
<p>In June 2014, <a href="https://github.com/ruby/ruby/commit/bb83f32dc3e0424d25fa4e55d8ff32b061320e41" class="external"><code>uri/common</code> was updated</a> to introduce a RFC3986-compliant parser (<code>URI::RFC3986_PARSER</code>) as an alternative to the previous RFC2396 parser, and common methods like <code>URI()</code> were updated to use that new parser by default. The only methods in <code>common</code> not updated were <a href="https://github.com/ruby/ruby/blob/28a17436503c3c4cb7a35b423a894b697cd80da9/lib/uri/common.rb#L233-L297" class="external"><code>URI.extract</code> and <code>URI.regexp</code></a> which are marked as obsolete. (The old parser was kept in the <code>DEFAULT_PARSER</code> constant despite it not being the default for those methods, presumably for backward compatibility.)</p>
<p>However, similar <a href="https://github.com/ruby/ruby/blob/28a17436503c3c4cb7a35b423a894b697cd80da9/lib/uri/generic.rb#L169-L175" class="external">methods called on <code>URI::Generic</code></a> were never updated to use this new parser. This means that methods like <code>URI::Generic.build</code> fail when given input that succeeds normally, and this also affects subclasses like URI::HTTP:</p>
<pre><code>$ pry -r uri -r uri/common -r uri/generic
[1] pry(main)> URI::Generic.build(host: "underscore_host.example")
URI::InvalidComponentError: bad component(expected host component): underscore_host.example
from /Users/gareth/.asdf/installs/ruby/3.1.3/lib/ruby/3.1.0/uri/generic.rb:591:in `check_host'
[2] pry(main)> URI::HTTP.build(host: "underscore_host.example")
URI::InvalidComponentError: bad component(expected host component): underscore_host.example
from /Users/gareth/.asdf/installs/ruby/3.1.3/lib/ruby/3.1.0/uri/generic.rb:591:in `check_host'
[3] pry(main)> URI("http://underscore_host.example")
=> #<URI::HTTP http://underscore_host.example>
</code></pre>
<p><code>URI::Generic.new</code> allows a configurable <code>parser</code> positional argument to override the class' default parser, but other factory methods like <code>.build</code> don't allow this override.</p>
<p>Arguably this doesn't cause problems because at least in the case above, the URI can be built with the polymorphic constructor, but having the option to build URIs from explicit named parts is useful, and leaving the outdated functionality in the <code>Generic</code> class is ambiguous. It's possible that the whole Generic class and its subclasses aren't intended to be used directly how I'm intending here, but there's nothing I could see that suggested this is the case.</p>
<p>I'm not aware of the entire list of differences between RFC2396 and RFC3986. The relevant difference here is that in RFC2396 an individual segment of a host (<a href="https://www.rfc-editor.org/rfc/rfc2396#section-3.2.2" class="external"><code>domainlabel</code>s</a>) could only be <code>alphanum | alphanum *( alphanum | "-" ) alphanum</code>, whereas RFC3986 allows <a href="https://www.rfc-editor.org/rfc/rfc3986#page-13" class="external">hostnames</a> to include any of <code>ALPHA / DIGIT / "-" / "." / "_" / "~"</code>. It's possible that other differences might cause issues for developers, but since this has gone over 8 years without anyone else caring about this, this is definitely not especially urgent.</p> Test - Bug #19186 (Open): test2https://bugs.ruby-lang.org/issues/191862022-12-06T01:25:49Zshugo (Shugo Maeda)
<p>Hello, this is a test issue.<br>
This is a second line with umlaut: ü</p> Test - Bug #19185 (Open): testhttps://bugs.ruby-lang.org/issues/191852022-12-06T01:24:24Zshugo (Shugo Maeda)
<p>hello, this is a test issue.<br>
This is a second line.</p> Ruby master - Bug #19172 (Open): `ruby_thread_has_gvl_p` is innacurate sometimes -- document or c...https://bugs.ruby-lang.org/issues/191722022-12-02T09:14:59Zivoanjo (Ivo Anjo)ivo.anjo@datadoghq.com
<p>Howdy 👋! I work for Datadog <a href="https://github.com/DataDog/dd-trace-rb" class="external">on the ddtrace gem</a> and I found a... sharp edge on the internal <code>ruby_thread_has_gvl_p</code> API.</p>
<p>I am aware that <code>ruby_thread_has_gvl_p</code> is documented an experimental API that is exported as a symbol but not present on the VM include files.</p>
<a name="Background"></a>
<h3 >Background<a href="#Background" class="wiki-anchor">¶</a></h3>
<p>In the ddtrace profiling component, we setup a signal handler and then periodically send SIGPROF signals to try to interrupt the running Ruby thread (e.g. the thread that is holding the global VM lock or equivalent).</p>
<p>In the signal handler, we need to perform some API calls which are not safe to do without the GVL. So we need to check if the signal handler got called in the thread that has the GVL.</p>
<a name="The-issue"></a>
<h3 >The issue<a href="#The-issue" class="wiki-anchor">¶</a></h3>
<pre><code class="c syntaxhl" data-language="c"><span class="kt">int</span>
<span class="nf">ruby_thread_has_gvl_p</span><span class="p">(</span><span class="kt">void</span><span class="p">)</span>
<span class="p">{</span>
<span class="n">rb_thread_t</span> <span class="o">*</span><span class="n">th</span> <span class="o">=</span> <span class="n">ruby_thread_from_native</span><span class="p">();</span>
<span class="k">if</span> <span class="p">(</span><span class="n">th</span> <span class="o">&&</span> <span class="n">th</span><span class="o">-></span><span class="n">blocking_region_buffer</span> <span class="o">==</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
<span class="k">return</span> <span class="mi">1</span><span class="p">;</span>
<span class="p">}</span>
<span class="k">else</span> <span class="p">{</span>
<span class="k">return</span> <span class="mi">0</span><span class="p">;</span>
<span class="p">}</span>
<span class="p">}</span>
</code></pre>
<p>In its current implementation, <code>ruby_thread_has_gvl_p</code> only checks if the thread has a <code>blocking_region_buffer</code> or not. Unfortunately, this means that when called from a thread that lost the GVL but not due to blocking (e.g. via <code>rb_thread_schedule()</code>), it can still claim that a thread is holding the GVL when that is not the case.</p>
<p>I ran into this issue in <a href="https://github.com/DataDog/dd-trace-rb/pull/2415" class="external">https://github.com/DataDog/dd-trace-rb/pull/2415</a>, and needed to find a workaround.</p>
<a name="Next-steps"></a>
<h3 >Next steps<a href="#Next-steps" class="wiki-anchor">¶</a></h3>
<p>Since this is an internal VM API, I'm not sure you'd want to change the current behavior, so I was thinking of perhaps two options:</p>
<ul>
<li>
<p>Is it worth changing <code>ruby_thread_has_gvl_p</code> to be accurate in the case I've listed?</p>
</li>
<li>
<p>If not, would you accept a PR to document its current limitations, so that others don't run into the same issue I did?</p>
</li>
</ul> Ruby master - Bug #19157 (Open): URI bad component validation can be trickedhttps://bugs.ruby-lang.org/issues/191572022-11-28T23:46:13Zstraight-shoota (Johannes Müller)
<p><code>URI::HTTP</code> checks the validity of the URI components. For example, the path of a URI with authority component must be either empty or start with a slash.</p>
<p>This validation applies on the <code>.build</code> constructor as well as on the <code>path</code> setter.<br>
But it can be tricked when setting an empty authority component and scheme before setting a relative path, and then setting the authority and scheme again.<br>
This produces an invalid and incorrect URI.</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="nb">require</span> <span class="s2">"uri"</span>
<span class="n">uri</span> <span class="o">=</span> <span class="no">URI</span><span class="o">::</span><span class="no">HTTP</span><span class="p">.</span><span class="nf">build</span><span class="p">({})</span>
<span class="n">uri</span><span class="p">.</span><span class="nf">scheme</span> <span class="o">=</span> <span class="kp">nil</span>
<span class="n">uri</span><span class="p">.</span><span class="nf">path</span> <span class="o">=</span> <span class="s2">"resource"</span>
<span class="n">uri</span><span class="p">.</span><span class="nf">host</span> <span class="o">=</span> <span class="s2">"example.com"</span> <span class="c1"># this should raise URI::InvalidComponentError</span>
<span class="n">uri</span><span class="p">.</span><span class="nf">scheme</span> <span class="o">=</span> <span class="s2">"http"</span>
<span class="n">uri</span><span class="p">.</span><span class="nf">to_s</span> <span class="c1"># => "http://example.comresource"</span>
</code></pre> Ruby master - Bug #19154 (Open): Specify require and autoload guarantees in ractorshttps://bugs.ruby-lang.org/issues/191542022-11-26T23:52:22Zfxn (Xavier Noria)fxn@hashref.com
<p>Given a file <code>c.rb</code>:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="k">class</span> <span class="nc">C</span>
<span class="k">end</span>
</code></pre>
<p>the following script:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="n">r1</span> <span class="o">=</span> <span class="no">Ractor</span><span class="p">.</span><span class="nf">new</span> <span class="k">do</span>
<span class="nb">require</span> <span class="s1">'./c.rb'</span>
<span class="k">end</span>
<span class="n">r2</span> <span class="o">=</span> <span class="no">Ractor</span><span class="p">.</span><span class="nf">new</span> <span class="k">do</span>
<span class="nb">require</span> <span class="s1">'./c.rb'</span>
<span class="k">end</span>
<span class="n">r1</span><span class="p">.</span><span class="nf">take</span>
<span class="n">r2</span><span class="p">.</span><span class="nf">take</span>
</code></pre>
<p>raises:</p>
<pre><code>% ruby -v foo.rb
ruby 3.2.0preview3 (2022-11-27) [x86_64-darwin22]
foo.rb:1: warning: Ractor is experimental, and the behavior may change in future versions of Ruby! Also there are many implementation issues.
#<Thread:0x000000010fee2928 run> terminated with exception (report_on_exception is true):
#<Thread:0x00000001102acfe0 run> terminated with exception (report_on_exception is true):
<internal:/Users/fxn/.rbenv/versions/3.2.0-preview3/lib/ruby/3.2.0+3/rubygems/core_ext/kernel_require.rb>:164:in `ensure in require': can not access non-shareable objects in constant Kernel::RUBYGEMS_ACTIVATION_MONITOR by non-main ractor. (Ractor::IsolationError)
from <internal:/Users/fxn/.rbenv/versions/3.2.0-preview3/lib/ruby/3.2.0+3/rubygems/core_ext/kernel_require.rb>:167:in `require'
from foo.rb:6:in `block in <main>'
<internal:/Users/fxn/.rbenv/versions/3.2.0-preview3/lib/ruby/3.2.0+3/rubygems/core_ext/kernel_require.rb>:37:in `require'<internal:/Users/fxn/.rbenv/versions/3.2.0-preview3/lib/ruby/3.2.0+3/rubygems/core_ext/kernel_require.rb>:164:in `ensure in require': : can not access non-shareable objects in constant Kernel::RUBYGEMS_ACTIVATION_MONITOR by non-main ractor. (Ractor::IsolationError)
from <internal:/Users/fxn/.rbenv/versions/3.2.0-preview3/lib/ruby/3.2.0+3/rubygems/core_ext/kernel_require.rb>:167:in `require'
can not access non-shareable objects in constant Kernel::RUBYGEMS_ACTIVATION_MONITOR by non-main ractor. (Ractor::IsolationError) from foo.rb:2:in `block in <main>'
<internal:/Users/fxn/.rbenv/versions/3.2.0-preview3/lib/ruby/3.2.0+3/rubygems/core_ext/kernel_require.rb>:37:in `require': can not access non-shareable objects in constant Kernel::RUBYGEMS_ACTIVATION_MONITOR by non-main ractor. (Ractor::IsolationError)
from foo.rb:2:in `block in <main>'
from foo.rb:6:in `block in <main>'
<internal:ractor>:698:in `take': thrown by remote Ractor. (Ractor::RemoteError)
from foo.rb:9:in `<main>'
<internal:/Users/fxn/.rbenv/versions/3.2.0-preview3/lib/ruby/3.2.0+3/rubygems/core_ext/kernel_require.rb>:164:in `ensure in require': can not access non-shareable objects in constant Kernel::RUBYGEMS_ACTIVATION_MONITOR by non-main ractor. (Ractor::IsolationError)
from <internal:/Users/fxn/.rbenv/versions/3.2.0-preview3/lib/ruby/3.2.0+3/rubygems/core_ext/kernel_require.rb>:167:in `require'
from foo.rb:2:in `block in <main>'
<internal:/Users/fxn/.rbenv/versions/3.2.0-preview3/lib/ruby/3.2.0+3/rubygems/core_ext/kernel_require.rb>:37:in `require': can not access non-shareable objects in constant Kernel::RUBYGEMS_ACTIVATION_MONITOR by non-main ractor. (Ractor::IsolationError)
from foo.rb:2:in `block in <main>'
</code></pre>
<p>Would it be possible to have documentation about their interaction?</p>
<p>This is important also to understand autoloading within ractors, since constant references may trigger <code>require</code> calls.</p> Ruby master - Bug #19112 (Open): Ractor garbage collection breaks/disables all active tracepointshttps://bugs.ruby-lang.org/issues/191122022-11-08T10:58:37Zivoanjo (Ivo Anjo)ivo.anjo@datadoghq.com
<p>Howdy 👋! I work for Datadog <a href="https://github.com/DataDog/dd-trace-rb" class="external">on the <code>ddtrace</code> gem</a> and I found an issue with Ractors + TracePoint.</p>
<a name="Background"></a>
<h3 >Background<a href="#Background" class="wiki-anchor">¶</a></h3>
<p>For tracking time spent in Garbage Collection on our Ruby profiler, we use a tracepoint that listens to the internal GC events. While doing other experiments around Ractors and profiling, I noticed that our tracepoint would suddenly stop working after Ractors were used in the application. I was able to reduce this down to the testcase below.</p>
<a name="How-to-reproduce-Ruby-version-amp-script"></a>
<h3 >How to reproduce (Ruby version & script)<a href="#How-to-reproduce-Ruby-version-amp-script" class="wiki-anchor">¶</a></h3>
<p>I was able to reproduce this on any Ruby 3 version, including master (<code>ruby 3.2.0dev (2022-11-08T08:08:48Z master cdb3ec3af8) [x86_64-linux]</code>).</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="nb">puts</span> <span class="no">RUBY_DESCRIPTION</span>
<span class="k">if</span> <span class="no">ENV</span><span class="p">[</span><span class="s1">'RUN_RACTOR'</span><span class="p">]</span> <span class="o">==</span> <span class="s1">'true'</span>
<span class="no">Ractor</span><span class="p">.</span><span class="nf">new</span> <span class="p">{</span> <span class="mi">10</span> <span class="p">}.</span><span class="nf">take</span>
<span class="nb">puts</span> <span class="s2">"Ractor ran!"</span>
<span class="k">else</span>
<span class="nb">puts</span> <span class="s2">"Ractor DID NOT ran!"</span>
<span class="k">end</span>
<span class="nb">puts</span> <span class="s2">"Enabling tracepoint"</span>
<span class="n">tracepoint</span> <span class="o">=</span> <span class="no">TracePoint</span><span class="p">.</span><span class="nf">new</span><span class="p">(</span><span class="ss">:line</span><span class="p">)</span> <span class="p">{</span> <span class="o">|</span><span class="n">tp</span><span class="o">|</span> <span class="nb">p</span> <span class="p">[</span><span class="n">tp</span><span class="p">.</span><span class="nf">path</span><span class="p">,</span> <span class="n">tp</span><span class="p">.</span><span class="nf">lineno</span><span class="p">,</span> <span class="n">tp</span><span class="p">.</span><span class="nf">event</span><span class="p">]</span> <span class="p">}.</span><span class="nf">tap</span><span class="p">(</span><span class="o">&</span><span class="ss">:enable</span><span class="p">)</span>
<span class="mi">5</span><span class="p">.</span><span class="nf">times</span> <span class="p">{</span> <span class="nb">puts</span> <span class="s2">"Triggering gc!"</span><span class="p">;</span> <span class="no">GC</span><span class="p">.</span><span class="nf">start</span> <span class="p">}</span>
<span class="nb">puts</span> <span class="s2">"Tracepoint state is enabled? </span><span class="si">#{</span><span class="n">tracepoint</span><span class="p">.</span><span class="nf">enabled?</span><span class="si">}</span><span class="s2">"</span>
<span class="nb">puts</span> <span class="s2">"Re-enabling tracepoint"</span>
<span class="n">tracepoint</span><span class="p">.</span><span class="nf">enable</span>
<span class="nb">puts</span> <span class="s2">"Finished!"</span>
</code></pre>
<a name="Expectation-and-result"></a>
<h3 >Expectation and result<a href="#Expectation-and-result" class="wiki-anchor">¶</a></h3>
<p>Without the Ractor, the tracepoint works as intended:</p>
<pre><code># RUN_RACTOR=false ./ruby ../ruby-3.1.2/triggergc.rb
ruby 3.2.0dev (2022-11-08T08:08:48Z master cdb3ec3af8) [x86_64-linux]
Ractor DID NOT ran!
Enabling tracepoint
["<internal:kernel>", 91, :line]
["../ruby-3.1.2/triggergc.rb", 14, :line]
["../ruby-3.1.2/triggergc.rb", 14, :line]
Triggering gc!
["<internal:gc>", 34, :line]
["../ruby-3.1.2/triggergc.rb", 14, :line]
Triggering gc!
["<internal:gc>", 34, :line]
["../ruby-3.1.2/triggergc.rb", 14, :line]
Triggering gc!
["<internal:gc>", 34, :line]
["../ruby-3.1.2/triggergc.rb", 14, :line]
Triggering gc!
["<internal:gc>", 34, :line]
["../ruby-3.1.2/triggergc.rb", 14, :line]
Triggering gc!
["<internal:gc>", 34, :line]
["../ruby-3.1.2/triggergc.rb", 16, :line]
["<internal:trace_point>", 257, :line]
Tracepoint state is enabled? true
["../ruby-3.1.2/triggergc.rb", 17, :line]
Re-enabling tracepoint
["../ruby-3.1.2/triggergc.rb", 18, :line]
["<internal:trace_point>", 213, :line]
["../ruby-3.1.2/triggergc.rb", 20, :line]
["../ruby-3.1.2/triggergc.rb", 20, :line]
Finished!
</code></pre>
<p>...but once the Ractor runs and is garbage collected, we see that the tracepoint breaks:</p>
<pre><code># RUN_RACTOR=true ./ruby ../ruby-3.1.2/triggergc.rb
ruby 3.2.0dev (2022-11-08T08:08:48Z master cdb3ec3af8) [x86_64-linux]
../ruby-3.1.2/triggergc.rb:5: warning: Ractor is experimental, and the behavior may change in future versions of Ruby! Also there are many implementation issues.
Ractor ran!
Enabling tracepoint
["<internal:kernel>", 91, :line]
["../ruby-3.1.2/triggergc.rb", 14, :line]
["../ruby-3.1.2/triggergc.rb", 14, :line]
Triggering gc!
["<internal:gc>", 34, :line]
Triggering gc!
Triggering gc!
Triggering gc!
Triggering gc!
Tracepoint state is enabled? true
Re-enabling tracepoint
["../ruby-3.1.2/triggergc.rb", 20, :line]
["../ruby-3.1.2/triggergc.rb", 20, :line]
Finished
</code></pre>
<a name="Additional-notes"></a>
<h3 >Additional notes<a href="#Additional-notes" class="wiki-anchor">¶</a></h3>
<p>This is a somewhat annoying bug, because it can break all gems that use tracepoints, including <code>ddtrace</code>. In particular for <code>ddtrace</code>, our plan is to disable the feature that uses tracepoints for Ruby 3 users, to avoid any issues from our tracepoints getting disabled.</p> Ruby master - Bug #19043 (Open): Segfault on macOS 11.7 while using StringScanner in multiple thr...https://bugs.ruby-lang.org/issues/190432022-10-06T21:08:47Zkeithdoggett (Keith Doggett)
<p>During testing on our CI, one of the runners failed due to a segfault that appears to have originated from the <code>StringScanner</code> class, specifically the <code>scan_until</code> method. The test ensures that we are able to properly parse strings in a multithreaded environment.</p>
<pre><code class="ruby syntaxhl" data-language="ruby"> <span class="k">def</span> <span class="nf">test_multithreaded</span>
<span class="n">parser</span> <span class="o">=</span> <span class="no">RGeo</span><span class="o">::</span><span class="no">WKRep</span><span class="o">::</span><span class="no">WKTParser</span><span class="p">.</span><span class="nf">new</span>
<span class="n">data</span> <span class="o">=</span> <span class="n">fixtures</span><span class="p">.</span><span class="nf">join</span><span class="p">(</span><span class="s2">"isere.wkt"</span><span class="p">).</span><span class="nf">read</span>
<span class="no">Array</span><span class="p">.</span><span class="nf">new</span><span class="p">(</span><span class="mi">100</span><span class="p">)</span> <span class="k">do</span>
<span class="no">Thread</span><span class="p">.</span><span class="nf">fork</span> <span class="k">do</span>
<span class="n">parser</span><span class="p">.</span><span class="nf">parse</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
<span class="k">end</span>
<span class="k">end</span><span class="p">.</span><span class="nf">map</span><span class="p">(</span><span class="o">&</span><span class="ss">:join</span><span class="p">)</span>
<span class="k">end</span>
</code></pre>
<p>Here's the <code>parse</code> method</p>
<pre><code class="ruby syntaxhl" data-language="ruby"> <span class="k">def</span> <span class="nf">parse</span><span class="p">(</span><span class="n">str</span><span class="p">)</span>
<span class="vi">@mutex</span><span class="p">.</span><span class="nf">synchronize</span> <span class="k">do</span>
<span class="n">str</span> <span class="o">=</span> <span class="n">str</span><span class="p">.</span><span class="nf">downcase</span>
<span class="vi">@cur_factory</span> <span class="o">=</span> <span class="vi">@exact_factory</span>
<span class="k">if</span> <span class="vi">@cur_factory</span>
<span class="vi">@cur_factory_support_z</span> <span class="o">=</span> <span class="vi">@cur_factory</span><span class="p">.</span><span class="nf">property</span><span class="p">(</span><span class="ss">:has_z_coordinate</span><span class="p">)</span> <span class="p">?</span> <span class="kp">true</span> <span class="p">:</span> <span class="kp">false</span>
<span class="vi">@cur_factory_support_m</span> <span class="o">=</span> <span class="vi">@cur_factory</span><span class="p">.</span><span class="nf">property</span><span class="p">(</span><span class="ss">:has_m_coordinate</span><span class="p">)</span> <span class="p">?</span> <span class="kp">true</span> <span class="p">:</span> <span class="kp">false</span>
<span class="k">end</span>
<span class="vi">@cur_expect_z</span> <span class="o">=</span> <span class="kp">nil</span>
<span class="vi">@cur_expect_m</span> <span class="o">=</span> <span class="kp">nil</span>
<span class="vi">@cur_srid</span> <span class="o">=</span> <span class="vi">@default_srid</span>
<span class="k">if</span> <span class="vi">@support_ewkt</span> <span class="o">&&</span> <span class="n">str</span> <span class="o">=~</span> <span class="sr">/^srid=(\d+);/i</span>
<span class="n">str</span> <span class="o">=</span> <span class="vg">$'</span>
<span class="vi">@cur_srid</span> <span class="o">=</span> <span class="no">Regexp</span><span class="p">.</span><span class="nf">last_match</span><span class="p">(</span><span class="mi">1</span><span class="p">).</span><span class="nf">to_i</span>
<span class="k">end</span>
<span class="k">begin</span>
<span class="n">start_scanner</span><span class="p">(</span><span class="n">str</span><span class="p">)</span>
<span class="n">obj</span> <span class="o">=</span> <span class="n">parse_type_tag</span>
<span class="k">if</span> <span class="vi">@cur_token</span> <span class="o">&&</span> <span class="o">!</span><span class="vi">@ignore_extra_tokens</span>
<span class="k">raise</span> <span class="no">Error</span><span class="o">::</span><span class="no">ParseError</span><span class="p">,</span> <span class="s2">"Extra tokens beginning with </span><span class="si">#{</span><span class="vi">@cur_token</span><span class="p">.</span><span class="nf">inspect</span><span class="si">}</span><span class="s2">."</span>
<span class="k">end</span>
<span class="k">ensure</span>
<span class="n">clean_scanner</span>
<span class="k">end</span>
<span class="n">obj</span>
<span class="k">end</span>
<span class="k">end</span>
</code></pre>
<p>Where the <code>StringScanner</code> is created and assigned to <code>@scanner</code> in <code>start_scanner</code> and <code>@scanner</code> is set to <code>nil</code> in <code>clean_scanner</code>. According to the control frame information in the log, the error is caused in the <code>scan_until</code> method, but it might be due to <code>gc_sweep</code> being run at some point.</p>
<p>Unfortunately since this happened on a CI system I don't have access to the diagnostic file. We've tried to replicate this locally unsuccessfully. The best we've done is caused a deadlock while trying to join the threads, but cannot reliably reproduce that. Here's a link to the CI run that caused the issue if that's helpful (<a href="https://github.com/rgeo/rgeo/actions/runs/3144578897/jobs/5110771257" class="external">https://github.com/rgeo/rgeo/actions/runs/3144578897/jobs/5110771257</a>).</p>
<p>If there's any tips on how to reproduce or anything you want me to try to get more information please let me know.</p> Ruby master - Bug #18966 (Open): Strange behavior when numbered parameters and method definition ...https://bugs.ruby-lang.org/issues/189662022-08-19T08:51:27Ztompng (tomoya ishida)tomoyapenguin@gmail.com
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="s1">'a'</span><span class="p">.</span><span class="nf">tap</span> <span class="p">{</span> <span class="nb">p</span> <span class="n">_1</span><span class="p">;</span> <span class="k">def</span> <span class="nf">f</span><span class="p">()</span><span class="o">=</span><span class="mi">42</span> <span class="p">}</span> <span class="c1">#=> "a"</span>
<span class="s1">'a'</span><span class="p">.</span><span class="nf">tap</span> <span class="p">{</span> <span class="nb">p</span> <span class="n">_1</span><span class="p">;</span> <span class="k">def</span> <span class="nf">f</span><span class="p">(</span><span class="n">a</span><span class="p">)</span><span class="o">=</span><span class="mi">42</span> <span class="p">}</span> <span class="c1">#=> nil</span>
<span class="s1">'a'</span><span class="p">.</span><span class="nf">tap</span> <span class="p">{</span> <span class="k">def</span> <span class="nf">f</span><span class="p">()</span><span class="o">=</span><span class="mi">42</span><span class="p">;</span> <span class="nb">p</span> <span class="n">_1</span> <span class="p">}</span> <span class="c1">#=> "a"</span>
<span class="s1">'a'</span><span class="p">.</span><span class="nf">tap</span> <span class="p">{</span> <span class="k">def</span> <span class="nf">f</span><span class="p">(</span><span class="n">a</span><span class="p">)</span><span class="o">=</span><span class="mi">42</span><span class="p">;</span> <span class="nb">p</span> <span class="n">_1</span> <span class="p">}</span> <span class="c1"># Syntax Error -:1: ordinary parameter is defined</span>
</code></pre> Ruby master - Bug #18947 (Open): Unexpected Errno::ENAMETOOLONG on Windowshttps://bugs.ruby-lang.org/issues/189472022-07-29T07:08:19Zinversion (Yura Babak)
<p>On Windows 10, I am working on a script to copy a complex folder structure.</p>
<p>Pathname and FileUtils work fine for me until there is a folder with a <strong>very long path</strong> (>260 chars).</p>
<p>Normally you cannot access such a folder with Ruby.<br>
The next operations will raise <code>Errno::ENOENT</code></p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="no">Pathname</span><span class="p">.</span><span class="nf">new</span><span class="p">(</span><span class="mi">300</span><span class="n">_chars_path</span><span class="p">).</span><span class="nf">children</span>
<span class="no">FileUtils</span><span class="p">.</span><span class="nf">mkpath</span><span class="p">(</span><span class="mi">300</span><span class="n">_chars_path</span><span class="p">)</span>
</code></pre>
<p>But there is a way in Windows to remove the MAX_PATH limitation.<br>
You can find a small .reg file in this article:<br>
<a href="https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry" class="external">https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry</a></p>
<p>After changing this system option, things start to work strangely in Ruby.</p>
<p>This will now raise <code>Errno::ENAMETOOLONG</code>:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="no">Pathname</span><span class="p">.</span><span class="nf">new</span><span class="p">(</span><span class="mi">300</span><span class="n">_chars_path</span><span class="p">).</span><span class="nf">children</span>
</code></pre>
<p>But at the same time, you can create a folder with such a long path and write-read a file in it</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="no">FileUtils</span><span class="p">.</span><span class="nf">mkpath</span><span class="p">(</span><span class="mi">300</span><span class="n">_chars_path</span><span class="p">)</span>
<span class="n">file</span> <span class="o">=</span> <span class="no">Pathname</span><span class="p">.</span><span class="nf">new</span><span class="p">(</span><span class="mi">300</span><span class="n">_chars_path</span><span class="o">+</span><span class="s1">'/file.txt'</span><span class="p">)</span>
<span class="n">file</span><span class="p">.</span><span class="nf">write</span> <span class="s1">'oooooooooo'</span>
<span class="nb">puts</span> <span class="no">Pathname</span><span class="p">.</span><span class="nf">new</span><span class="p">(</span><span class="mi">300</span><span class="n">_chars_path</span><span class="o">+</span><span class="s1">'/file.txt'</span><span class="p">).</span><span class="nf">read</span>
</code></pre>
<p>So you can work with individual items but attempts to list such folders' content fail (<code>.children</code>, <code>.glob</code>, <code>.copy</code>, etc).<br>
In my case, deep <code>.glob</code> is broken for all the parent folders of that deep long-path folder ((</p>
<p>The only way I found for listing is</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="nb">require</span> <span class="s1">'win32ole'</span>
<span class="n">fso</span> <span class="o">=</span> <span class="no">WIN32OLE</span><span class="p">.</span><span class="nf">new</span> <span class="s1">'Scripting.FileSystemObject'</span>
<span class="k">for</span> <span class="n">file</span> <span class="k">in</span> <span class="n">fso</span><span class="o">.</span><span class="no">GetFolder</span><span class="p">(</span><span class="mi">300</span><span class="n">_chars_path</span><span class="p">).</span><span class="nf">files</span>
<span class="n">file</span><span class="p">.</span><span class="nf">name</span>
<span class="n">file</span><span class="p">.</span><span class="nf">path</span><span class="p">.</span><span class="nf">length</span>
<span class="k">end</span>
</code></pre>
<p>But using this workaround breaks all my code workflow built on top of Pathname and FileUtils ((.</p>
<p>So for me, it looks like some operations with long-path folders are not working just because in Ruby there is a check for the path length and not a real operation problem. And in some places (see .mkpath) there is no such check and all works fine.</p>
<p>Also notice that other applications on Windows have no problems with long-path folders (like Total Commander).</p>
<p>Please consider reviewing if we really need to raise <code>Errno::ENAMETOOLONG</code> if the <code>LongPathsEnabled</code> option is enabled in the Windows registry.</p> Ruby master - Bug #18903 (Open): Stack overflow signal handling seems to be triggered once and th...https://bugs.ruby-lang.org/issues/189032022-07-07T14:33:01Zchrisseaton (Chris Seaton)chris@chrisseaton.com
<p>This program creates a recursive object graph and then tries to convert it to JSON with no max depth, so it stack overflows in C code that does no co-operative stack overflow checks, as the bytecode interpreter would. This therefore triggers a segmentation fault and the stack overflow detection there. It works the first time, but the second time around it doesn't and the program hard crashes on M1.</p>
<p>Is there something like a guard page permission that is switched during the handling, and needs to switched back for the guard page to work again?</p>
<p>Note that it isn't JSON specific - I think any stack overflow within C code would do it.</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="nb">require</span> <span class="s1">'json'</span>
<span class="n">a</span> <span class="o">=</span> <span class="p">[]</span>
<span class="n">a</span> <span class="o"><<</span> <span class="n">a</span>
<span class="k">begin</span>
<span class="no">JSON</span><span class="p">.</span><span class="nf">dump</span><span class="p">(</span><span class="n">a</span><span class="p">)</span>
<span class="k">rescue</span> <span class="no">Exception</span>
<span class="nb">puts</span> <span class="s1">'rescued'</span>
<span class="k">end</span>
<span class="no">JSON</span><span class="p">.</span><span class="nf">dump</span><span class="p">(</span><span class="n">a</span><span class="p">)</span>
</code></pre> Ruby master - Bug #18842 (Open): Ruby's Resolv library does not handle correctly the `NODATA` casehttps://bugs.ruby-lang.org/issues/188422022-06-19T17:39:19Zpiradata (Guilherme Ferreira)
<p>Hello, I am opening this issue based on the following DNS bug sleuthing:</p>
<p><a href="https://gitlab.com/gitlab-org/charts/gitlab/-/issues/3303" class="external">https://gitlab.com/gitlab-org/charts/gitlab/-/issues/3303</a></p>
<p>As described by Stan Hu, seems like the Ruby's Resolv library does not handle correctly the <code>NODATA</code> case because if any of the searchpaths return the <code>NODATA</code> response the search stops there and the domain is not correctly resolved, as the correct resolution should be using the input address as FQDN.</p>
<p>Ruby looks at the DNS response code (<a href="https://github.com/ruby/ruby/blob/9c0df2e81c22e6e35f3c5d69a070c2a3cf67e320/lib/resolv.rb#L532-L552" class="external">https://github.com/ruby/ruby/blob/9c0df2e81c22e6e35f3c5d69a070c2a3cf67e320/lib/resolv.rb#L532-L552</a>), which is described in <a href="https://datatracker.ietf.org/doc/html/rfc2929#section-2.3" class="external">https://datatracker.ietf.org/doc/html/rfc2929#section-2.3</a>.</p>
<p>We are assuming that, as described in the issue, the .aws search path caused the DNS to return "No error" and DNS Resolver interprets it as valid.</p>
<p>Busybox's nslookup implementation mentions the NODATA case here: <a href="https://git.busybox.net/busybox/tree/networking/nslookup.c?h=1_35_stable#n650" class="external">https://git.busybox.net/busybox/tree/networking/nslookup.c?h=1_35_stable#n650</a>. <a href="https://datatracker.ietf.org/doc/html/rfc2308#section-2.2.1" class="external">https://datatracker.ietf.org/doc/html/rfc2308#section-2.2.1</a> and may describe the problem with Ruby's Resolv implementation:</p>
<pre><code>There are a large number of resolvers currently in existence that
fail to correctly detect and process all forms of NODATA response.
Some resolvers treat a TYPE 1 NODATA response as a referral. To
alleviate this problem it is recommended that servers that are
authoritative for the NODATA response only send TYPE 2 NODATA
responses, that is the authority section contains a SOA record and no
NS records. Sending a TYPE 1 NODATA response from a non-
authoritative server to one of these resolvers will only result in an
unnecessary query. If a server is listed as a FORWARDER for another
resolver it may also be necessary to disable the sending of TYPE 1
NODATA response for non-authoritative NODATA responses.
Some name servers fail to set the RCODE to NXDOMAIN in the presence
of CNAMEs in the answer section. If a definitive NXDOMAIN / NODATA
answer is required in this case the resolver must query again using
the QNAME as the query label.
</code></pre>
<p>As it sounded like a Ruby bug report I decided to open this issue in order to correctly to handle the NODATA case.</p>
<p>The link for the sleuthing of the problem part: <a href="https://gitlab.com/gitlab-org/charts/gitlab/-/issues/3303#note_950108922" class="external">https://gitlab.com/gitlab-org/charts/gitlab/-/issues/3303#note_950108922</a> and the specific problem can be found on the start of the comment when we could not resolve the DNS unless we removed the aws searchpath as this serachpath specifically was returning the <code>NODATA</code> response.</p> Ruby master - Bug #18818 (Open): Thread waitq does not retain referenced objects, can lead to use...https://bugs.ruby-lang.org/issues/188182022-06-05T21:39:16Znevans (Nicholas Evans)
<p>The attached script (and/or others like it) can cause SEGV in 3.0, 3.1, and master. It has always behaved as expected when I use <code>optflags=-O0</code>.</p>
<p>When I use it with <code>make run</code> on <code>master</code>:</p>
<pre><code>./miniruby -I../lib -I. -I.ext/common -r./x86_64-linux-fake ../test.rb
========================================================================
fiber_queue
completed in 0.00031349004711955786
========================================================================
fiber_sized_queue
../test.rb:62: [BUG] Segmentation fault at 0x0000000000000000
ruby 3.2.0dev (2022-06-05T06:18:26Z master 5ce0be022f) [x86_64-linux]
-- Control frame information -----------------------------------------------
c:0005 p:---- s:0023 e:000022 CFUNC :%
c:0004 p:0031 s:0018 e:000015 METHOD ../test.rb:62 [FINISH]
c:0003 p:---- s:0010 e:000009 CFUNC :pop
c:0002 p:0009 s:0006 e:000005 BLOCK ../test.rb:154 [FINISH]
c:0001 p:---- s:0003 e:000002 (none) [FINISH]
-- Ruby level backtrace information ----------------------------------------
../test.rb:154:in `block (2 levels) in <main>'
../test.rb:154:in `pop'
../test.rb:62:in `unblock'
../test.rb:62:in `%'
-- Machine register context ------------------------------------------------
RIP: 0x000055eae9ffa417 RBP: 0x00007f80aba855d8 RSP: 0x00007f80a9789598
RAX: 0x000000000000009b RBX: 0x00007f80a9789628 RCX: 0x00007f80ab9c37a0
RDX: 0x00007f80a97895c0 RDI: 0x0000000000000000 RSI: 0x000000000000009b
R8: 0x0000000000000000 R9: 0x00007f80a97895c0 R10: 0x0000000055550083
R11: 0x00007f80ac32ace0 R12: 0x00007f80aba855d8 R13: 0x00007f80ab9c3780
R14: 0x00007f80a97895c0 R15: 0x000000000000009b EFL: 0x0000000000010202
-- C level backtrace information -------------------------------------------
./miniruby(rb_vm_bugreport+0x5cf) [0x55eaea06b0ef]
./miniruby(rb_bug_for_fatal_signal+0xec) [0x55eae9e4fc2c]
./miniruby(sigsegv+0x4d) [0x55eae9fba30d]
[0x7f80ac153520]
./miniruby(rb_id_table_lookup+0x7) [0x55eae9ffa417]
./miniruby(callable_method_entry+0x103) [0x55eaea046bd3]
./miniruby(vm_respond_to+0x3f) [0x55eaea056c1f]
./miniruby(rb_check_funcall_default_kw+0x19c) [0x55eaea05788c]
./miniruby(rb_check_convert_type_with_id+0x8e) [0x55eae9f1b85e]
./miniruby(rb_str_format_m+0x1a) [0x55eae9fce82a]
./miniruby(vm_call_cfunc_with_frame+0x127) [0x55eaea041ac7]
./miniruby(vm_exec_core+0x114) [0x55eaea05d684]
./miniruby(rb_vm_exec+0x187) [0x55eaea04e747]
./miniruby(rb_funcallv_scope+0x1b0) [0x55eaea05a770]
./miniruby(rb_fiber_scheduler_unblock+0x3e) [0x55eae9fb979e]
./miniruby(sync_wakeup+0x10d) [0x55eae9ffd45d]
./miniruby(rb_szqueue_pop+0xf5) [0x55eae9ffefd5]
./miniruby(vm_call_cfunc_with_frame+0x127) [0x55eaea041ac7]
./miniruby(vm_exec_core+0x114) [0x55eaea05d684]
./miniruby(rb_vm_exec+0x187) [0x55eaea04e747]
./miniruby(rb_vm_invoke_proc+0x5f) [0x55eaea05584f]
./miniruby(rb_fiber_start+0x1da) [0x55eae9e1e24a]
./miniruby(fiber_entry+0x0) [0x55eae9e1e550]
</code></pre>
<p>I've attached the rest of the VM dump. <code>make runruby</code> gives a nearly identical dump. I can post a core dump or <code>rr</code> recording, if needed.<br>
_<br>
I'm sorry I didn't simplify the script more; small, seemingly irrelevant changes can change the failure or allow it to pass. Sometimes it raises a bizarre exception instead of SEGV, most commonly a NoMethodError which seemingly indicates that the local vars have been shifted or scrambled. For example, this particular SEGV was caused by a guard clause checking that <code>unblock(blocker, fiber)</code> was given a Fiber object. Here, that object is invalid, but I've seen it be a string or some other object from elsewhere in the process.</p>
<p>For comparison, this is what the script output should look like:</p>
<pre><code>========================================================================
fiber_queue
completed in 0.00031569297425448895
========================================================================
fiber_sized_queue
completed in 0.1176840600091964
========================================================================
fiber_sized_queue2
completed in 0.19209402799606323
========================================================================
fiber_sized_queue3
completed in 0.21404067997355014
========================================================================
fiber_sized_queue4
completed in 0.30277197097893804
</code></pre>
<p>I was attempting to create some simple benchmarks for <code>Queue</code> and <code>SizedQueue</code> with fibers, to mimic <code>benchmark/vm_thread_*queue*.rb</code>. I never completed the benchmarks because of this SEGV. :)</p> Ruby master - Bug #18794 (Open): Windows - intermittent SEGV TestObjSpace#test_reachable_objects_...https://bugs.ruby-lang.org/issues/187942022-05-20T17:19:08ZMSP-Greg (Greg L)
<p>Test runs in retry, generates the following (removed path from x64-ucrt-ruby320.dll). mswin build runs it as a single test, I don't believe it's failed.</p>
<pre><code> 1) Failure:
TestObjSpace#test_reachable_objects_during_iteration Line: 145
assert_separately failed with error message
pid 70572 exit 3
| -:8: [BUG] Unnormalized Fixnum value 0x0000023f8eeb2119
| ruby 3.2.0dev (2022-05-20T15:42:07Z master 11336c7ddb) [x64-mingw-ucrt]
|
| -- Control frame information -----------------------------------------------
| c:0006 p:---- s:0021 e:000020 CFUNC :to_s
| c:0005 p:---- s:0018 e:000017 CFUNC :inspect
| c:0004 p:0004 s:0014 e:000013 BLOCK -:8 [FINISH]
| c:0003 p:---- s:0010 e:000009 CFUNC :each_object
| c:0002 p:0073 s:0006 e:000005 EVAL -:7 [FINISH]
| c:0001 p:0000 s:0003 E:002060 (none) [FINISH]
|
| -- Ruby level backtrace information ----------------------------------------
| -:7:in `<main>'
| -:7:in `each_object'
| -:8:in `block in <main>'
| -:8:in `inspect'
| -:8:in `to_s'
|
| -- C level backtrace information -------------------------------------------
| C:\Windows\SYSTEM32\ntdll.dll(NtWaitForSingleObject+0x14) [0x00007ffbdb40ef74]
| C:\Windows\System32\KERNELBASE.dll(WaitForSingleObjectEx+0x8e) [0x00007ffbd89fe7ae]
| x64-ucrt-ruby320.dll(rb_vm_bugreport+0x313) [0x00007ffba62417c3]
| x64-ucrt-ruby320.dll(rb_bug_without_die+0x75) [0x00007ffba6039d15]
| x64-ucrt-ruby320.dll(rb_bug+0x33) [0x00007ffba626e014]
| x64-ucrt-ruby320.dll(rb_out_of_int+0x42) [0x00007ffba626f81b]
| x64-ucrt-ruby320.dll(rb_vm_invoke_proc+0x22c) [0x00007ffba622c34c]
| x64-ucrt-ruby320.dll(rb_eval_cmd_kw+0x5ea) [0x00007ffba6230e7a]
| x64-ucrt-ruby320.dll(rb_funcallv+0x11) [0x00007ffba62310c1]
| x64-ucrt-ruby320.dll(rb_inspect+0x17) [0x00007ffba60f9417]
| x64-ucrt-ruby320.dll(rb_hash_values+0xfc1) [0x00007ffba606e791]
| x64-ucrt-ruby320.dll(rb_hash_values+0x102c) [0x00007ffba606e7fc]
| x64-ucrt-ruby320.dll(rb_st_foreach_check+0x77) [0x00007ffba61a1637]
| x64-ucrt-ruby320.dll(rb_hash_set_default_proc+0x1e19) [0x00007ffba60724a9]
| x64-ucrt-ruby320.dll(rb_ensure+0x18f) [0x00007ffba60453af]
| x64-ucrt-ruby320.dll(rb_hash_set_default_proc+0x2272) [0x00007ffba6072902]
| x64-ucrt-ruby320.dll(rb_hash_aset+0x1d1f) [0x00007ffba6077c2f]
| x64-ucrt-ruby320.dll(rb_mutex_trylock+0x51c) [0x00007ffba61d864c]
| x64-ucrt-ruby320.dll(rb_exec_recursive+0x17) [0x00007ffba61e0217]
| x64-ucrt-ruby320.dll(rb_error_arity+0x26e) [0x00007ffba62182ee]
| x64-ucrt-ruby320.dll(rb_vm_call_with_refinements+0x47d) [0x00007ffba6233fed]
| x64-ucrt-ruby320.dll(rb_vm_exec+0x255) [0x00007ffba62252a5]
| x64-ucrt-ruby320.dll(rb_yield+0x1e8) [0x00007ffba622ac88]
| x64-ucrt-ruby320.dll(rb_obj_id+0x1c94) [0x00007ffba6057024]
| x64-ucrt-ruby320.dll(rb_size_mul_or_raise+0x154) [0x00007ffba605c464]
| x64-ucrt-ruby320.dll(rb_ensure+0x18f) [0x00007ffba60453af]
| x64-ucrt-ruby320.dll(rb_objspace_each_objects_without_setup+0x1ac) [0x00007ffba606562c]
| x64-ucrt-ruby320.dll(rb_error_arity+0x26e) [0x00007ffba62182ee]
| x64-ucrt-ruby320.dll(rb_vm_search_method_slowpath+0x723) [0x00007ffba621ce33]
| x64-ucrt-ruby320.dll(rb_vm_call_with_refinements+0x4e8) [0x00007ffba6234058]
| x64-ucrt-ruby320.dll(rb_vm_exec+0x255) [0x00007ffba62252a5]
| x64-ucrt-ruby320.dll(rb_call_end_proc+0x130) [0x00007ffba603e400]
| x64-ucrt-ruby320.dll(ruby_run_node+0xa5) [0x00007ffba6044145]
| [0x00007ff62fcc15a8]
| [0x00007ff62fcc13b1]
| [0x00007ff62fcc14e6]
| C:\Windows\System32\KERNEL32.DLL(BaseThreadInitThunk+0x10) [0x00007ffbd93c4ed0]
</code></pre> Ruby master - Bug #18740 (Open): Use of rightward assignment changes line number needed for line-...https://bugs.ruby-lang.org/issues/187402022-04-18T10:00:41Zhurricup (Alexandr Evstigneev)hurricup@gmail.com
<p>Affected ruby 3.1.1</p>
<p>Sample illustrating the problem (<code>test.rb</code>):</p>
<pre><code>def foo
File.read("test.rb")
.split("\n")
.map(&:strip)
.reject(&:empty?)
.first(10) => lines
puts lines
end
TracePoint.new(:line){ puts 'Hi' }.enable(target: RubyVM::InstructionSequence.of(method :foo), target_line: 2)
foo
</code></pre>
<p>produces</p>
<pre><code><internal:trace_point>:212:in `enable': can not enable any hooks (ArgumentError)
</code></pre>
<p>iseq for method:</p>
<pre><code>== disasm: #<ISeq:foo@/home/hurricup/test.rb:1 (1,0)-(9,3)> (catch: FALSE)
local table (size: 1, argc: 0 [opts: 0, rest: -1, post: 0, block: -1, kw: -1@-1, kwrest: -1])
[ 1] lines@0
0000 putnil ( 6)[LiCa]
0001 putnil
0002 putobject false
0004 putnil
0005 putnil
0006 opt_getinlinecache 15, <is:0> ( 2)
0009 putobject true
0011 getconstant :File
0013 opt_setinlinecache <is:0>
0015 putstring "test.rb"
0017 opt_send_without_block <calldata!mid:read, argc:1, ARGS_SIMPLE>
0019 putstring "\n" ( 3)
0021 opt_send_without_block <calldata!mid:split, argc:1, ARGS_SIMPLE>
0023 putobject :strip ( 4)
0025 send <calldata!mid:map, argc:0, ARGS_BLOCKARG>, nil
0028 putobject :empty? ( 5)
0030 send <calldata!mid:reject, argc:0, ARGS_BLOCKARG>, nil
0033 putobject 10 ( 6)
0035 opt_send_without_block <calldata!mid:first, argc:1, ARGS_SIMPLE>
0037 dup
0038 setlocal_WC_0 lines@0
0040 jump 88
0042 putspecialobject 1 ( 2)
0044 topn 4
0046 branchif 64
0048 putobject NoMatchingPatternError
0050 putspecialobject 1
0052 putobject "%p: %s"
0054 topn 4
0056 topn 7
0058 opt_send_without_block <calldata!mid:core#sprintf, argc:3, ARGS_SIMPLE>
0060 opt_send_without_block <calldata!mid:core#raise, argc:2, ARGS_SIMPLE>
0062 jump 84
0064 putobject NoMatchingPatternKeyError
0066 putspecialobject 1
0068 putobject "%p: %s"
0070 topn 4
0072 topn 7
0074 opt_send_without_block <calldata!mid:core#sprintf, argc:3, ARGS_SIMPLE>
0076 topn 7
0078 topn 9
0080 opt_send_without_block <calldata!mid:new, argc:3, kw:[matchee,key], KWARG>
0082 opt_send_without_block <calldata!mid:core#raise, argc:1, ARGS_SIMPLE>
0084 adjuststack 7
0086 jump 90
0088 adjuststack 6 ( 6)
0090 putself ( 8)[Li]
0091 getlocal_WC_0 lines@0
0093 opt_send_without_block <calldata!mid:puts, argc:1, FCALL|ARGS_SIMPLE>
0095 leave ( 9)[Re]
</code></pre>
<p>Works like a charm without <code>=> lines</code></p> Ruby master - Bug #18733 (Open): Ruby GC problems cause performance issue with Ractorhttps://bugs.ruby-lang.org/issues/187332022-04-15T05:04:10Zjakit (Jakit Liang)
<p>Code:</p>
<pre><code>require 'benchmark'
def fib(n)
return n if [0,1].include?(n)
fib(n-1) + fib(n-2)
end
tp = []
puts Benchmark.measure {
8.times do
tp << fork { fib(37) }
end
tp.each { |t| Process.wait(t) }
}
puts Benchmark.measure {
8.times.map {
Ractor.new { fib(37) }
}.each{ |r| r.take }
}
</code></pre>
<p>Result:</p>
<table>
<thead>
<tr>
<th>A</th>
<th>B</th>
</tr>
</thead>
<tbody>
<tr>
<td>fork</td>
<td>0.000264 0.003439 87.181198 ( 11.211349)</td>
</tr>
<tr>
<td>Ractor</td>
<td>80.292916 15.062559 95.355475 ( 39.569527)</td>
</tr>
</tbody>
</table>
<p>And I found that here's the problem showing on the ActiveMonitor.app:</p>
<p><img src="http://jakit.cn/screen_shot_ruby_bug.jpg" alt="ruby_bug_with_m1"></p>
<p>As you can see, the process of ruby is always using all Performance Cores on my Apple M1 Mac.</p>
<p>But there's no one of the Efficiency Cores was in used by ruby Ractor.</p> Ruby master - Bug #18608 (Open): `require': cannot load such file -- ripper (LoadError) after `ma...https://bugs.ruby-lang.org/issues/186082022-03-03T19:51:39Zbrandonrdn (Brandon Riden)
<p>When compiling multiple instances of Ruby (In our case, two separate prefixes), using the following build code causes the 2nd installed Ruby to throw an error on any ruby/irb call.</p>
<p>Changing the code to delete the extracted <code>ruby-3.1.0</code> folder and re-extract from the tarball fixes this issue, so I believe it's something in the <code>make distclean</code> that's causing issues. This was not an issue for ruby 2.6.3 or 2.6.7, just on 3.0+ versions.</p>
<p>Build code:</p>
<pre><code># Build Ruby
RUN set -e ; \
. /etc/profile.d/ccache.sh ; \
wget -q https://cache.ruby-lang.org/pub/ruby/${RUBY_VERSION%.*}/ruby-${RUBY_VERSION}.tar.gz ; \
tar zxf ruby-${RUBY_VERSION}.tar.gz ; \
rm -f ruby-${RUBY_VERSION}.tar.gz ; \
pushd ruby-${RUBY_VERSION} ; \
type -p gcc ; \
for prefix in /usr/local /opt/vendored_ruby ; do \
./configure --prefix=$prefix --with-compress-debug-sections=no --disable-install-doc ; \
make ; \
make install ; \
make distclean ; \
done ; \
popd ; \
ccache --show-stats ; \
rm -rf ruby-${RUBY_VERSION} /root/.ccache
</code></pre>
<p>Error:</p>
<pre><code><internal:/opt/vendored_ruby/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require': cannot load such file -- ripper (LoadError)
from <internal:/opt/vendored_ruby/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
from /opt/vendored_ruby/lib/ruby/3.1.0/irb.rb:12:in `<top (required)>'
from <internal:/opt/vendored_ruby/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
from <internal:/opt/vendored_ruby/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
from /opt/vendored_ruby/lib/ruby/gems/3.1.0/gems/irb-1.4.1/exe/irb:9:in `<top (required)>'
from /opt/vendored_ruby/bin/irb:25:in `load'
from /opt/vendored_ruby/bin/irb:25:in `<main>'
[root@cc75157e1b69 /]# /usr/local/bin/irb
irb(main):001:0>
</code></pre>
<p>This error pops up on any reference to ruby or irb, including the base commands.</p>
<p>Steps to reproduce:</p>
<ul>
<li>Compile/make/make install Ruby 3.0+ with the 1st prefix</li>
<li>Run <code>make distclean</code>
</li>
<li>Compile/make/make install Ruby 3.0+ with the 2nd prefix</li>
<li>run the <code>irb</code> and <code>ruby</code> commands in both paths.</li>
</ul> Ruby master - Bug #18510 (Open): Unexpected waiting for console when starting ruby on windowshttps://bugs.ruby-lang.org/issues/185102022-01-23T14:53:12ZYO4 (Yoshinao Muramatsu)
<a name="ruby-version"></a>
<h1 >ruby version<a href="#ruby-version" class="wiki-anchor">¶</a></h1>
<p>C:\Ruby31-x64\bin>"c:\Ruby31-x64\bin\ruby.exe" -v<br>
ruby 3.1.0p0 (2021-12-25 revision fb4df44d16) [x64-mingw-ucrt]</p>
<p>older versions have same issue too.</p>
<a name="how-to-reproduce"></a>
<h1 >how to reproduce<a href="#how-to-reproduce" class="wiki-anchor">¶</a></h1>
<p>execute ruby.exe from cmd.exe command promput like concatenating the quoted path and file name notation</p>
<pre><code>C:\Ruby31-x64\bin>"c:\Ruby31-x64\bin\"ruby.exe -v
# => wait for console input unexpectedly
puts "This is Console Input"^Z
=> This is Console Input
# ruby terminated, version not appear
</code></pre>
<p>It seems to commandline separation issue.</p> Ruby master - Bug #18492 (Open): `rb_rescue2` inside `rb_protect` segfaults on Windowshttps://bugs.ruby-lang.org/issues/184922022-01-14T15:17:58Zbyroot (Jean Boussier)byroot@ruby-lang.org
<p>I ran into and interpreter segfault that <a class="user active user-mention" href="https://bugs.ruby-lang.org/users/42491">@peterzhu2118 (Peter Zhu)</a> helped me reduce to s simple test case:</p>
<pre><code class="c syntaxhl" data-language="c"><span class="cp">#include</span> <span class="cpf"><ruby.h></span><span class="cp">
</span>
<span class="k">static</span> <span class="n">VALUE</span>
<span class="nf">rescue_return_false</span><span class="p">(</span><span class="n">VALUE</span> <span class="n">arg</span><span class="p">,</span> <span class="n">VALUE</span> <span class="n">e</span><span class="p">)</span>
<span class="p">{</span>
<span class="k">return</span> <span class="n">Qfalse</span><span class="p">;</span>
<span class="p">}</span>
<span class="k">static</span> <span class="n">VALUE</span>
<span class="nf">try_callback</span><span class="p">(</span><span class="n">VALUE</span> <span class="n">arg</span><span class="p">)</span>
<span class="p">{</span>
<span class="n">rb_raise</span><span class="p">(</span><span class="n">rb_eStandardError</span><span class="p">,</span> <span class="s">"Repro"</span><span class="p">);</span>
<span class="p">}</span>
<span class="k">static</span> <span class="n">VALUE</span>
<span class="nf">prot_callback</span><span class="p">(</span><span class="n">VALUE</span> <span class="n">arg</span><span class="p">)</span>
<span class="p">{</span>
<span class="k">return</span> <span class="n">rb_rescue2</span><span class="p">(</span>
<span class="n">try_callback</span><span class="p">,</span> <span class="n">arg</span><span class="p">,</span>
<span class="n">rescue_return_false</span><span class="p">,</span> <span class="n">Qnil</span><span class="p">,</span>
<span class="n">rb_eRuntimeError</span><span class="p">,</span> <span class="mi">0</span><span class="p">);</span>
<span class="p">}</span>
<span class="n">VALUE</span> <span class="nf">repro_call</span><span class="p">(</span><span class="n">VALUE</span> <span class="n">self</span><span class="p">)</span>
<span class="p">{</span>
<span class="kt">int</span> <span class="n">state</span><span class="p">;</span>
<span class="n">rb_protect</span><span class="p">(</span><span class="n">prot_callback</span><span class="p">,</span> <span class="n">Qnil</span><span class="p">,</span> <span class="o">&</span><span class="n">state</span><span class="p">);</span>
<span class="k">if</span> <span class="p">(</span><span class="n">state</span><span class="p">)</span> <span class="p">{</span>
<span class="n">rb_jump_tag</span><span class="p">(</span><span class="n">state</span><span class="p">);</span>
<span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
<span class="k">return</span> <span class="n">Qtrue</span><span class="p">;</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="kt">void</span>
<span class="nf">Init_repro</span><span class="p">()</span>
<span class="p">{</span>
<span class="n">VALUE</span> <span class="n">m_Repro</span> <span class="o">=</span> <span class="n">rb_define_module_under</span><span class="p">(</span><span class="n">rb_cObject</span><span class="p">,</span> <span class="s">"Repro"</span><span class="p">);</span>
<span class="n">rb_define_singleton_method</span><span class="p">(</span><span class="n">m_Repro</span><span class="p">,</span> <span class="s">"call"</span><span class="p">,</span> <span class="n">repro_call</span><span class="p">,</span> <span class="mi">0</span><span class="p">);</span>
<span class="p">}</span>
</code></pre>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="nb">require</span> <span class="s2">"test_helper"</span>
<span class="k">class</span> <span class="nc">ReproTest</span> <span class="o"><</span> <span class="no">Minitest</span><span class="o">::</span><span class="no">Test</span>
<span class="k">def</span> <span class="nf">test_raises</span>
<span class="n">assert_raises</span> <span class="k">do</span>
<span class="no">Repro</span><span class="p">.</span><span class="nf">call</span>
<span class="k">end</span>
<span class="k">end</span>
<span class="k">end</span>
</code></pre>
<a name="Expected-behavior"></a>
<h3 >Expected behavior<a href="#Expected-behavior" class="wiki-anchor">¶</a></h3>
<p>I expect <code>Repro.call</code> to reraise the <code>StandardError</code>.</p>
<a name="Actual-behavior"></a>
<h3 >Actual behavior<a href="#Actual-behavior" class="wiki-anchor">¶</a></h3>
<p>It works as expected on Ubuntu and MacOS, but segfaults on Windows:</p>
<pre><code>D:/a/rbprotect-repro/rbprotect-repro/test/repro_test.rb:8: [BUG] Segmentation fault
ruby 3.1.0p0 (2021-12-25 revision fb4df44d16) [x64-mingw-ucrt]
-- Control frame information -----------------------------------------------
c:0026 p:---- s:0138 e:000137 CFUNC :call
c:0025 p:0011 s:0134 e:000133 BLOCK D:/a/rbprotect-repro/rbprotect-repro/test/repro_test.rb:8
c:0024 p:0064 s:0131 e:000130 METHOD C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/minitest-5.15.0/lib/minitest/assertions.rb:402
c:0023 p:0004 s:0124 e:000123 METHOD D:/a/rbprotect-repro/rbprotect-repro/test/repro_test.rb:7
c:0022 p:0018 s:0120 e:000119 BLOCK C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/minitest-5.15.0/lib/minitest/test.rb:98
c:0021 p:0002 s:0117 e:000116 METHOD C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/minitest-5.15.0/lib/minitest/test.rb:195
c:0020 p:0004 s:0112 e:000111 BLOCK C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/minitest-5.15.0/lib/minitest/test.rb:95
c:0019 p:0015 s:0109 e:000108 METHOD C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/minitest-5.15.0/lib/minitest.rb:281
c:0018 p:0004 s:0104 e:000103 BLOCK C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/minitest-5.15.0/lib/minitest/test.rb:94
c:0017 p:0029 s:0101 e:000100 METHOD C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/minitest-5.15.0/lib/minitest.rb:376
c:0016 p:0044 s:0093 E:000a98 METHOD C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/minitest-5.15.0/lib/minitest/test.rb:221
c:0015 p:0004 s:0086 E:0022c0 METHOD C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/minitest-5.15.0/lib/minitest/test.rb:93
c:0014 p:0008 s:0082 e:000081 METHOD C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/minitest-5.15.0/lib/minitest.rb:1042
c:0013 p:0026 s:0075 e:000073 METHOD C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/minitest-5.15.0/lib/minitest.rb:350
c:0012 p:0009 s:0067 e:000066 BLOCK C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/minitest-5.15.0/lib/minitest.rb:337 [FINISH]
c:0011 p:---- s:0063 e:000062 CFUNC :each
c:0010 p:0005 s:0059 e:000058 BLOCK C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/minitest-5.15.0/lib/minitest.rb:336
c:0009 p:0029 s:0056 e:000055 METHOD C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/minitest-5.15.0/lib/minitest.rb:376
c:0008 p:0029 s:0048 E:000a58 METHOD C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/minitest-5.15.0/lib/minitest.rb:363
c:0007 p:0117 s:0041 E:0025e8 METHOD C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/minitest-5.15.0/lib/minitest.rb:335
c:0006 p:0008 s:0032 e:000031 BLOCK C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/minitest-5.15.0/lib/minitest.rb:169 [FINISH]
c:0005 p:---- s:0028 e:000027 CFUNC :map
c:0004 p:0035 s:0024 e:000023 METHOD C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/minitest-5.15.0/lib/minitest.rb:169
c:0003 p:0142 s:0015 e:000014 METHOD C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/minitest-5.15.0/lib/minitest.rb:146
c:0002 p:0073 s:0008 E:0015a0 BLOCK C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/minitest-5.15.0/lib/minitest.rb:73 [FINISH]
c:0001 p:0000 s:0003 E:0009a0 (none) [FINISH]
-- Ruby level backtrace information ----------------------------------------
C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/minitest-5.15.0/lib/minitest.rb:73:in `block in autorun'
C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/minitest-5.15.0/lib/minitest.rb:146:in `run'
C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/minitest-5.15.0/lib/minitest.rb:169:in `__run'
C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/minitest-5.15.0/lib/minitest.rb:169:in `map'
C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/minitest-5.15.0/lib/minitest.rb:169:in `block in __run'
C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/minitest-5.15.0/lib/minitest.rb:335:in `run'
C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/minitest-5.15.0/lib/minitest.rb:363:in `with_info_handler'
C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/minitest-5.15.0/lib/minitest.rb:376:in `on_signal'
C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/minitest-5.15.0/lib/minitest.rb:336:in `block in run'
C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/minitest-5.15.0/lib/minitest.rb:336:in `each'
C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/minitest-5.15.0/lib/minitest.rb:337:in `block (2 levels) in run'
C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/minitest-5.15.0/lib/minitest.rb:350:in `run_one_method'
C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/minitest-5.15.0/lib/minitest.rb:1042:in `run_one_method'
C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/minitest-5.15.0/lib/minitest/test.rb:93:in `run'
C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/minitest-5.15.0/lib/minitest/test.rb:221:in `with_info_handler'
C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/minitest-5.15.0/lib/minitest.rb:376:in `on_signal'
C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/minitest-5.15.0/lib/minitest/test.rb:94:in `block in run'
C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/minitest-5.15.0/lib/minitest.rb:281:in `time_it'
C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/minitest-5.15.0/lib/minitest/test.rb:95:in `block (2 levels) in run'
C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/minitest-5.15.0/lib/minitest/test.rb:195:in `capture_exceptions'
C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/minitest-5.15.0/lib/minitest/test.rb:98:in `block (3 levels) in run'
D:/a/rbprotect-repro/rbprotect-repro/test/repro_test.rb:7:in `test_raises'
C:/hostedtoolcache/windows/Ruby/3.1.0/x64/lib/ruby/gems/3.1.0/gems/minitest-5.15.0/lib/minitest/assertions.rb:402:in `assert_raises'
D:/a/rbprotect-repro/rbprotect-repro/test/repro_test.rb:8:in `block in test_raises'
D:/a/rbprotect-repro/rbprotect-repro/test/repro_test.rb:8:in `call'
-- C level backtrace information -------------------------------------------
C:\Windows\SYSTEM32\ntdll.dll(NtWaitForSingleObject+0x14) [0x00007ffa0905fa74]
C:\Windows\System32\KERNELBASE.dll(WaitForSingleObjectEx+0x93) [0x00007ffa059485c3]
C:\hostedtoolcache\windows\Ruby\3.1.0\x64\bin\x64-ucrt-ruby310.dll(rb_vm_bugreport+0x2b3) [0x00007ff9d488b633]
C:\hostedtoolcache\windows\Ruby\3.1.0\x64\bin\x64-ucrt-ruby310.dll(rb_bug_for_fatal_signal+0x88) [0x00007ff9d4683d88]
C:\hostedtoolcache\windows\Ruby\3.1.0\x64\bin\x64-ucrt-ruby310.dll(rb_fiber_scheduler_address_resolve+0x2be) [0x00007ff9d47dc02e]
[0x00007ff6c4731f32]
C:\Windows\System32\ucrtbase.dll(_C_specific_handler+0xa0) [0x00007ffa05c1e210]
C:\Windows\SYSTEM32\ntdll.dll(_chkstk+0x11f) [0x00007ffa09064a2f]
C:\Windows\SYSTEM32\ntdll.dll(RtlWalkFrameChain+0x14bf) [0x00007ffa08fc4cef]
C:\Windows\SYSTEM32\ntdll.dll(KiUserExceptionDispatcher+0x2e) [0x00007ffa0906379e]
C:\hostedtoolcache\windows\Ruby\3.1.0\x64\bin\x64-ucrt-ruby310.dll(rb_obj_is_kind_of+0x77) [0x00007ff9d473f697]
C:\hostedtoolcache\windows\Ruby\3.1.0\x64\bin\x64-ucrt-ruby310.dll(rb_vrescue2+0x32b) [0x00007ff9d468eb0b]
C:\hostedtoolcache\windows\Ruby\3.1.0\x64\bin\x64-ucrt-ruby310.dll(rb_rescue2+0x2a) [0x00007ff9d468ebaa]
[0x00007ff9d3fd1447]
C:\hostedtoolcache\windows\Ruby\3.1.0\x64\bin\x64-ucrt-ruby310.dll(rb_protect+0x155) [0x00007ff9d468ed45]
[0x00007ff9d3fd13dc]
C:\hostedtoolcache\windows\Ruby\3.1.0\x64\bin\x64-ucrt-ruby310.dll(rb_error_arity+0x26e) [0x00007ff9d486280e]
C:\hostedtoolcache\windows\Ruby\3.1.0\x64\bin\x64-ucrt-ruby310.dll(rb_vm_call_with_refinements+0x45d) [0x00007ff9d487e1ad]
C:\hostedtoolcache\windows\Ruby\3.1.0\x64\bin\x64-ucrt-ruby310.dll(rb_vm_exec+0x142) [0x00007ff9d486f052]
C:\hostedtoolcache\windows\Ruby\3.1.0\x64\bin\x64-ucrt-ruby310.dll(rb_yield+0x1e8) [0x00007ff9d4874be8]
C:\hostedtoolcache\windows\Ruby\3.1.0\x64\bin\x64-ucrt-ruby310.dll(rb_ary_each+0x3d) [0x00007ff9d45e62cd]
C:\hostedtoolcache\windows\Ruby\3.1.0\x64\bin\x64-ucrt-ruby310.dll(rb_error_arity+0x26e) [0x00007ff9d486280e]
C:\hostedtoolcache\windows\Ruby\3.1.0\x64\bin\x64-ucrt-ruby310.dll(rb_vm_search_method_slowpath+0x692) [0x00007ff9d4866e72]
C:\hostedtoolcache\windows\Ruby\3.1.0\x64\bin\x64-ucrt-ruby310.dll(rb_vm_call_with_refinements+0x4bf) [0x00007ff9d487e20f]
C:\hostedtoolcache\windows\Ruby\3.1.0\x64\bin\x64-ucrt-ruby310.dll(rb_vm_exec+0x142) [0x00007ff9d486f052]
C:\hostedtoolcache\windows\Ruby\3.1.0\x64\bin\x64-ucrt-ruby310.dll(rb_yield+0x1e8) [0x00007ff9d4874be8]
C:\hostedtoolcache\windows\Ruby\3.1.0\x64\bin\x64-ucrt-ruby310.dll(rb_ary_sort_bang+0xda2) [0x00007ff9d45ee402]
C:\hostedtoolcache\windows\Ruby\3.1.0\x64\bin\x64-ucrt-ruby310.dll(rb_error_arity+0x26e) [0x00007ff9d486280e]
C:\hostedtoolcache\windows\Ruby\3.1.0\x64\bin\x64-ucrt-ruby310.dll(rb_vm_search_method_slowpath+0x692) [0x00007ff9d4866e72]
C:\hostedtoolcache\windows\Ruby\3.1.0\x64\bin\x64-ucrt-ruby310.dll(rb_vm_call_with_refinements+0x4bf) [0x00007ff9d487e20f]
C:\hostedtoolcache\windows\Ruby\3.1.0\x64\bin\x64-ucrt-ruby310.dll(rb_vm_exec+0x142) [0x00007ff9d486f052]
C:\hostedtoolcache\windows\Ruby\3.1.0\x64\bin\x64-ucrt-ruby310.dll(rb_vm_invoke_proc+0x78) [0x00007ff9d4876178]
C:\hostedtoolcache\windows\Ruby\3.1.0\x64\bin\x64-ucrt-ruby310.dll(rb_proc_call+0x94) [0x00007ff9d477b484]
C:\hostedtoolcache\windows\Ruby\3.1.0\x64\bin\x64-ucrt-ruby310.dll(rb_ec_error_print+0xaf8) [0x00007ff9d468cbd8]
C:\hostedtoolcache\windows\Ruby\3.1.0\x64\bin\x64-ucrt-ruby310.dll(rb_ec_error_print+0xdcb) [0x00007ff9d468ceab]
C:\hostedtoolcache\windows\Ruby\3.1.0\x64\bin\x64-ucrt-ruby310.dll(rb_ec_error_print+0x10a2) [0x00007ff9d468d182]
C:\hostedtoolcache\windows\Ruby\3.1.0\x64\bin\x64-ucrt-ruby310.dll(ruby_run_node+0xaf) [0x00007ff9d468ddbf]
[0x00007ff6c4732ab9]
[0x00007ff6c47313b1]
[0x00007ff6c47314e6]
C:\Windows\System32\KERNEL32.DLL(BaseThreadInitThunk+0x14) [0x00007ffa08b57974]
</code></pre>
<a name="Full-repro"></a>
<h3 >Full repro<a href="#Full-repro" class="wiki-anchor">¶</a></h3>
<p>The full repro source code can be found at <a href="https://github.com/casperisfine/rbprotect-repro" class="external">https://github.com/casperisfine/rbprotect-repro</a></p>
<p>The CI is configured to run on Windows, Ubuntu and MacOS, from Ruby 2.5 to ruby-head</p> Ruby master - Bug #18473 (Open): Raw data in Socket::Option#inspect on Amazon Linux 2 https://bugs.ruby-lang.org/issues/184732022-01-11T14:13:29Zdriv3r (Leszek Zalewski)
<p>Hello,</p>
<p>I found a weird issue when running attached script. Locally on Ubuntu running kernel 5.11, on CI (GitHub Actions) and through docker image (ruby:3.1.0-alpine3.15), the response is as it should be with all data parsed correctly:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="c1">#<Socket::Option: INET TCP INFO state=LISTEN ca_state=Open retransmits=0 probes=0 backoff=0 options=0 rto=0.000000s ato=0.000000s snd_mss=0 rcv_mss=0 unacked=0 sacked=1024 lost=0 retrans=0 fackets=0 last_data_sent=0.000s last_ack_sent=0.000s last_data_recv=0.000s last_ack_recv=0.000s pmtu=0 rcv_ssthresh=0 rtt=0.000000s rttvar=0.000000s snd_ssthresh=0 snd_cwnd=10 advmss=0 reordering=3 rcv_rtt=0.000000s rcv_space=0 total_retrans=0 (128 bytes too long)></span>
</code></pre>
<p>The issue happens when running exactly the same docker image on AWS Fargate, where instead of expected output above, we get</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="s2">"#<Socket::Option: INET TCP INFO </span><span class="se">\"\\</span><span class="s2">n</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x80</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">n</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x03</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">xFF</span><span class="se">\\</span><span class="s2">xFF</span><span class="se">\\</span><span class="s2">xFF</span><span class="se">\\</span><span class="s2">xFF</span><span class="se">\\</span><span class="s2">xFF</span><span class="se">\\</span><span class="s2">xFF</span><span class="se">\\</span><span class="s2">xFF</span><span class="se">\\</span><span class="s2">xFF</span><span class="se">\\</span><span class="s2">xFF</span><span class="se">\\</span><span class="s2">xFF</span><span class="se">\\</span><span class="s2">xFF</span><span class="se">\\</span><span class="s2">xFF</span><span class="se">\\</span><span class="s2">xFF</span><span class="se">\\</span><span class="s2">xFF</span><span class="se">\\</span><span class="s2">xFF</span><span class="se">\\</span><span class="s2">xFF</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\\</span><span class="s2">x00</span><span class="se">\"</span><span class="s2">>"</span>
</code></pre>
<p>After further testing even simple EC2 with Amazon Linux 2 @4.14 kernel gives same output, 5.10 works fine.</p>
<p>Steps to reproduce:</p>
<ul>
<li>boot up EC2 instance with Amazon Linux v2 @ kernel 4.14 (no idea how to run it locally, I might assist if needed)</li>
<li>install docker
<pre><code class="bash syntaxhl" data-language="bash"><span class="nb">sudo </span>yum <span class="nb">install </span>docker
<span class="nb">sudo </span>systemctl start docker.service
<span class="nb">sudo </span>docker run <span class="nt">-it</span> ruby:3.1.0-alpine3.15
</code></pre>
</li>
<li>execute the attached script</li>
</ul> Ruby master - Bug #18444 (Open): Trapped TSTP causes a locking deadlock in 3.0.3 onwardhttps://bugs.ruby-lang.org/issues/184442021-12-28T16:01:45Zwhy-el (Mohamed Wael Khobalatte)
<p>A curious case:</p>
<p><code>ruby -e 'Signal.trap("TSTP") { puts "Received a terminal stop signal, but i will sleep instead."; sleep 10 }; loop {puts 1}'</code></p>
<p>this fails with <code>deadlock; recursive locking (ThreadError)</code> when I send the SIGTSTP via my terminal. This is on Mac OS Monterey (M1). It only happens in 3.0.3 and onward (I tried 3.1.0-preview1 as well, fails there too), when I try 3.0.2, the signal is handled properly.</p> Ruby master - Bug #18412 (Open): Segfault in test_ractor.rbhttps://bugs.ruby-lang.org/issues/184122021-12-16T09:18:39Zvo.x (Vit Ondruch)v.ondruch@tiscali.cz
<p>During build of Ruby 3.0.3 for Fedora, I sometimes bump into this issue:</p>
<pre><code>... snip ...
test_attr.rb ..
test_autoload.rb ........
test_block.rb ..........................................................
test_class.rb ................................................
test_env.rb ..
test_eval.rb .....................................
test_exception.rb ..................................
test_fiber.rb .....
test_finalizer.rb .
test_flip.rb .
test_flow.rb ..............................................................
test_fork.rb ....
test_gc.rb ..
test_insns.rb ...............................................................................................................................................................................................................................................................................................................................................................................................
test_io.rb .........
test_jump.rb .............................
test_literal.rb ............................................................................................................................................................
test_literal_suffix.rb ................................................
test_load.rb ..
test_marshal.rb .
test_massign.rb ..................................
test_method.rb ...............................................................................................................................................................................................................................
test_objectspace.rb ......
test_proc.rb .....................................
test_ractor.rb .........................................................................................Fstderr output is not empty
<internal:ractor>:627: [BUG] Segmentation fault at 0x0000000000000038
ruby 3.0.3p157 (2021-11-24 revision 3fb7d2cadc) [powerpc64le-linux]
-- Control frame information -----------------------------------------------
c:0005 p:0003 s:0020 e:000019 METHOD <internal:ractor>:627
c:0004 p:0032 s:0013 e:000012 BLOCK bootstraptest.tmp.rb:6 [FINISH]
c:0003 p:---- s:0010 e:000009 CFUNC :loop
c:0002 p:0005 s:0006 e:000005 BLOCK bootstraptest.tmp.rb:4 [FINISH]
c:0001 p:---- s:0003 e:000002 (none) [FINISH]
-- Ruby level backtrace information ----------------------------------------
bootstraptest.tmp.rb:4:in `block (2 levels) in <main>'
bootstraptest.tmp.rb:4:in `loop'
bootstraptest.tmp.rb:6:in `block (3 levels) in <main>'
<internal:ractor>:627:in `yield'
-- C level backtrace information -------------------------------------------
/builddir/build/BUILD/ruby-3.0.3/libruby.so.3.0.3(rb_print_backtrace+0x24) [0x7fffb1dd3604] vm_dump.c:758
/builddir/build/BUILD/ruby-3.0.3/libruby.so.3.0.3(rb_vm_bugreport.constprop.0+0x5c0) [0x7fffb1df1780] vm_dump.c:998
/builddir/build/BUILD/ruby-3.0.3/libruby.so.3.0.3(rb_bug_for_fatal_signal+0xa4) [0x7fffb1bbdc74] error.c:786
/builddir/build/BUILD/ruby-3.0.3/libruby.so.3.0.3(sigsegv+0x68) [0x7fffb1d2a4a8] signal.c:963
[0x7fffb1f80464]
[0x7fffb191ad68]
/builddir/build/BUILD/ruby-3.0.3/libruby.so.3.0.3(rb_native_mutex_lock+0x18) [0x7fffb1d6f558] thread_pthread.c:397
/builddir/build/BUILD/ruby-3.0.3/libruby.so.3.0.3(ractor_select+0x480) [0x7fffb1cda060] ractor.c:61
/builddir/build/BUILD/ruby-3.0.3/libruby.so.3.0.3(builtin_inline_class_627.lto_priv.0+0x50) [0x7fffb1cdaa30] ractor.c:1286
/builddir/build/BUILD/ruby-3.0.3/libruby.so.3.0.3(builtin_invoker0.lto_priv.0+0x24) [0x7fffb1db5624] vm_insnhelper.c:5445
/builddir/build/BUILD/ruby-3.0.3/libruby.so.3.0.3(vm_exec_core.lto_priv.0+0x254c) [0x7fffb1dbfe6c] insns.def:1493
/builddir/build/BUILD/ruby-3.0.3/libruby.so.3.0.3(rb_vm_exec+0x130) [0x7fffb1ddc7e0] vm.c:2172
/builddir/build/BUILD/ruby-3.0.3/libruby.so.3.0.3(loop_i+0x2e4) [0x7fffb1dc7bd4] vm.c:1263
/builddir/build/BUILD/ruby-3.0.3/libruby.so.3.0.3(rb_vrescue2+0xec) [0x7fffb1bbc6cc] eval.c:1019
/builddir/build/BUILD/ruby-3.0.3/libruby.so.3.0.3(rb_rescue2+0x3c) [0x7fffb1bbc8bc] eval.c:996
/builddir/build/BUILD/ruby-3.0.3/libruby.so.3.0.3(rb_f_loop.lto_priv.0+0x58) [0x7fffb1dc87c8] vm_eval.c:1483
/builddir/build/BUILD/ruby-3.0.3/libruby.so.3.0.3(ractor_safe_call_cfunc_0.lto_priv.0+0x24) [0x7fffb1da7904] vm_insnhelper.c:2748
/builddir/build/BUILD/ruby-3.0.3/libruby.so.3.0.3(vm_call_cfunc_with_frame+0x150) [0x7fffb1db2650] vm_insnhelper.c:2931
/builddir/build/BUILD/ruby-3.0.3/libruby.so.3.0.3(vm_sendish.lto_priv.0+0x3dc) [0x7fffb1db7b0c] vm_insnhelper.c:4532
/builddir/build/BUILD/ruby-3.0.3/libruby.so.3.0.3(vm_exec_core.lto_priv.0+0x1890) [0x7fffb1dbf1b0] insns.def:770
/builddir/build/BUILD/ruby-3.0.3/libruby.so.3.0.3(rb_vm_exec+0x130) [0x7fffb1ddc7e0] vm.c:2172
/builddir/build/BUILD/ruby-3.0.3/libruby.so.3.0.3(vm_invoke_proc.lto_priv.0+0x2c0) [0x7fffb1dcfc90] vm.c:1263
/builddir/build/BUILD/ruby-3.0.3/libruby.so.3.0.3(thread_do_start_proc.lto_priv.0+0x5ac) [0x7fffb1d7852c] vm.c:1499
/builddir/build/BUILD/ruby-3.0.3/libruby.so.3.0.3(thread_start_func_2.constprop.0.isra.0+0x958) [0x7fffb1dfacf8] thread.c:759
/builddir/build/BUILD/ruby-3.0.3/libruby.so.3.0.3(thread_start_func_1+0x180) [0x7fffb1d70070] thread_pthread.c:994
[0x7fffb1916264]
[0x7fffb19c5f30]
-- Other runtime information -----------------------------------------------
* Loaded script: bootstraptest.tmp.rb
* Loaded features:
0 enumerator.so
1 thread.rb
2 rational.so
3 complex.so
4 ruby2_keywords.rb
5 /builddir/build/BUILD/ruby-3.0.3/.ext/powerpc64le-linux/enc/encdb.so
6 /builddir/build/BUILD/ruby-3.0.3/.ext/powerpc64le-linux/enc/trans/transdb.so
7 /builddir/build/BUILD/ruby-3.0.3/abrt.rb
* Process memory map:
102330000-102340000 r--p 00000000 fc:06 1076662947 /builddir/build/BUILD/ruby-3.0.3/ruby
102340000-102350000 r-xp 00010000 fc:06 1076662947 /builddir/build/BUILD/ruby-3.0.3/ruby
102350000-102360000 r--p 00020000 fc:06 1076662947 /builddir/build/BUILD/ruby-3.0.3/ruby
102360000-102370000 r--p 00020000 fc:06 1076662947 /builddir/build/BUILD/ruby-3.0.3/ruby
102370000-102380000 rw-p 00030000 fc:06 1076662947 /builddir/build/BUILD/ruby-3.0.3/ruby
134320000-134530000 rw-p 00000000 00:00 0 [heap]
7fff88000000-7fff88bd0000 rw-p 00000000 00:00 0
7fff88bd0000-7fff8c000000 ---p 00000000 00:00 0
7fff8c000000-7fff8cd90000 rw-p 00000000 00:00 0
7fff8cd90000-7fff90000000 ---p 00000000 00:00 0
7fff90000000-7fff901e0000 rw-p 00000000 00:00 0
7fff901e0000-7fff94000000 ---p 00000000 00:00 0
7fff94000000-7fff94be0000 rw-p 00000000 00:00 0
7fff94be0000-7fff98000000 ---p 00000000 00:00 0
7fff98000000-7fff99320000 rw-p 00000000 00:00 0
7fff99320000-7fff9c000000 ---p 00000000 00:00 0
7fff9c000000-7fff9cc40000 rw-p 00000000 00:00 0
7fff9cc40000-7fffa0000000 ---p 00000000 00:00 0
7fffa0000000-7fffa0d60000 rw-p 00000000 00:00 0
7fffa0d60000-7fffa4000000 ---p 00000000 00:00 0
7fffa7ed0000-7fffa7ee0000 ---p 00000000 00:00 0
7fffa7ee0000-7fffa8000000 rw-p 00000000 00:00 0
7fffa8000000-7fffa91a0000 rw-p 00000000 00:00 0
7fffa91a0000-7fffac000000 ---p 00000000 00:00 0
7fffada60000-7fffadaa0000 r--s 00000000 fc:06 1076662947 /builddir/build/BUILD/ruby-3.0.3/ruby
7fffadaa0000-7fffadab0000 r--p 00000000 fc:06 1614754146 /usr/lib64/libgcc_s-11-20211203.so.1
7fffadab0000-7fffadac0000 r-xp 00010000 fc:06 1614754146 /usr/lib64/libgcc_s-11-20211203.so.1
7fffadac0000-7fffadad0000 r--p 00020000 fc:06 1614754146 /usr/lib64/libgcc_s-11-20211203.so.1
7fffadad0000-7fffadae0000 r--p 00020000 fc:06 1614754146 /usr/lib64/libgcc_s-11-20211203.so.1
7fffadae0000-7fffadaf0000 rw-p 00030000 fc:06 1614754146 /usr/lib64/libgcc_s-11-20211203.so.1
7fffadaf0000-7fffadb00000 ---p 00000000 00:00 0
7fffadb00000-7fffadc20000 rw-p 00000000 00:00 0
7fffadc20000-7fffadc30000 ---p 00000000 00:00 0
7fffadc30000-7fffadd50000 rw-p 00000000 00:00 0
7fffadd50000-7fffadd60000 ---p 00000000 00:00 0
7fffadd60000-7fffade80000 rw-p 00000000 00:00 0
7fffade80000-7fffade90000 ---p 00000000 00:00 0
7fffade90000-7fffadfb0000 rw-p 00000000 00:00 0
7fffadfb0000-7fffadfc0000 ---p 00000000 00:00 0
7fffadfc0000-7fffae0e0000 rw-p 00000000 00:00 0
7fffae0e0000-7fffae0f0000 ---p 00000000 00:00 0
7fffae0f0000-7fffae210000 rw-p 00000000 00:00 0
7fffae210000-7fffae220000 ---p 00000000 00:00 0
7fffae220000-7fffae340000 rw-p 00000000 00:00 0
7fffae340000-7fffae350000 r--p 00000000 fc:06 1616770133 /builddir/build/BUILD/ruby-3.0.3/.ext/powerpc64le-linux/enc/trans/transdb.so
7fffae350000-7fffae360000 r-xp 00010000 fc:06 1616770133 /builddir/build/BUILD/ruby-3.0.3/.ext/powerpc64le-linux/enc/trans/transdb.so
7fffae360000-7fffae370000 r--p 00020000 fc:06 1616770133 /builddir/build/BUILD/ruby-3.0.3/.ext/powerpc64le-linux/enc/trans/transdb.so
7fffae370000-7fffae380000 r--p 00020000 fc:06 1616770133 /builddir/build/BUILD/ruby-3.0.3/.ext/powerpc64le-linux/enc/trans/transdb.so
7fffae380000-7fffae390000 rw-p 00000000 00:00 0
7fffae390000-7fffae3a0000 r--p 00000000 fc:06 1076646137 /builddir/build/BUILD/ruby-3.0.3/.ext/powerpc64le-linux/enc/encdb.so
7fffae3a0000-7fffae3b0000 r-xp 00010000 fc:06 1076646137 /builddir/build/BUILD/ruby-3.0.3/.ext/powerpc64le-linux/enc/encdb.so
7fffae3b0000-7fffae3c0000 r--p 00020000 fc:06 1076646137 /builddir/build/BUILD/ruby-3.0.3/.ext/powerpc64le-linux/enc/encdb.so
7fffae3c0000-7fffae3d0000 r--p 00020000 fc:06 1076646137 /builddir/build/BUILD/ruby-3.0.3/.ext/powerpc64le-linux/enc/encdb.so
7fffae3d0000-7fffae3e0000 rw-p 00000000 00:00 0
7fffae3e0000-7fffae3f0000 ---p 00000000 00:00 0
7fffae3f0000-7fffae460000 rw-p 00000000 00:00 0
7fffae460000-7fffae470000 ---p 00000000 00:00 0
7fffae470000-7fffae4e0000 rw-p 00000000 00:00 0
7fffae4e0000-7fffae4f0000 ---p 00000000 00:00 0
7fffae4f0000-7fffae560000 rw-p 00000000 00:00 0
7fffae560000-7fffae570000 ---p 00000000 00:00 0
7fffae570000-7fffae5e0000 rw-p 00000000 00:00 0
7fffae5e0000-7fffae5f0000 ---p 00000000 00:00 0
7fffae5f0000-7fffae660000 rw-p 00000000 00:00 0
7fffae660000-7fffae670000 ---p 00000000 00:00 0
7fffae670000-7fffae6e0000 rw-p 00000000 00:00 0
7fffae6e0000-7fffae6f0000 ---p 00000000 00:00 0
7fffae6f0000-7fffae760000 rw-p 00000000 00:00 0
7fffae760000-7fffae770000 ---p 00000000 00:00 0
7fffae770000-7fffae7e0000 rw-p 00000000 00:00 0
7fffae7e0000-7fffae7f0000 ---p 00000000 00:00 0
7fffae7f0000-7fffae860000 rw-p 00000000 00:00 0
7fffae860000-7fffae870000 ---p 00000000 00:00 0
7fffae870000-7fffae8e0000 rw-p 00000000 00:00 0
7fffae8e0000-7fffae8f0000 ---p 00000000 00:00 0
7fffae8f0000-7fffae960000 rw-p 00000000 00:00 0
7fffae960000-7fffae970000 ---p 00000000 00:00 0
7fffae970000-7fffae9e0000 rw-p 00000000 00:00 0
7fffae9e0000-7fffae9f0000 ---p 00000000 00:00 0
7fffae9f0000-7fffaea60000 rw-p 00000000 00:00 0
7fffaea60000-7fffaea70000 ---p 00000000 00:00 0
7fffaea70000-7fffaeae0000 rw-p 00000000 00:00 0
7fffaeae0000-7fffaeaf0000 ---p 00000000 00:00 0
7fffaeaf0000-7fffaeb60000 rw-p 00000000 00:00 0
7fffaeb60000-7fffaeb70000 ---p 00000000 00:00 0
7fffaeb70000-7fffaebe0000 rw-p 00000000 00:00 0
7fffaebe0000-7fffaebf0000 ---p 00000000 00:00 0
7fffaebf0000-7fffaec60000 rw-p 00000000 00:00 0
7fffaec60000-7fffaec70000 ---p 00000000 00:00 0
7fffaec70000-7fffaece0000 rw-p 00000000 00:00 0
7fffaece0000-7fffaecf0000 ---p 00000000 00:00 0
7fffaecf0000-7fffaed60000 rw-p 00000000 00:00 0
7fffaed60000-7fffaed70000 ---p 00000000 00:00 0
7fffaed70000-7fffaede0000 rw-p 00000000 00:00 0
7fffaede0000-7fffaedf0000 ---p 00000000 00:00 0
7fffaedf0000-7fffaee60000 rw-p 00000000 00:00 0
7fffaee60000-7fffaee70000 ---p 00000000 00:00 0
7fffaee70000-7fffaeee0000 rw-p 00000000 00:00 0
7fffaeee0000-7fffaeef0000 ---p 00000000 00:00 0
7fffaeef0000-7fffaef60000 rw-p 00000000 00:00 0
7fffaef60000-7fffaef70000 ---p 00000000 00:00 0
7fffaef70000-7fffaefe0000 rw-p 00000000 00:00 0
7fffaefe0000-7fffaeff0000 ---p 00000000 00:00 0
7fffaeff0000-7fffaf060000 rw-p 00000000 00:00 0
7fffaf060000-7fffaf070000 ---p 00000000 00:00 0
7fffaf070000-7fffaf0e0000 rw-p 00000000 00:00 0
7fffaf0e0000-7fffaf0f0000 ---p 00000000 00:00 0
7fffaf0f0000-7fffaf160000 rw-p 00000000 00:00 0
7fffaf160000-7fffaf170000 ---p 00000000 00:00 0
7fffaf170000-7fffaf1e0000 rw-p 00000000 00:00 0
7fffaf1e0000-7fffaf1f0000 ---p 00000000 00:00 0
7fffaf1f0000-7fffaf260000 rw-p 00000000 00:00 0
7fffaf260000-7fffaf270000 ---p 00000000 00:00 0
7fffaf270000-7fffaf2e0000 rw-p 00000000 00:00 0
7fffaf2e0000-7fffaf2f0000 ---p 00000000 00:00 0
7fffaf2f0000-7fffaf360000 rw-p 00000000 00:00 0
7fffaf360000-7fffaf370000 ---p 00000000 00:00 0
7fffaf370000-7fffb1570000 rw-p 00000000 00:00 0
7fffb1570000-7fffb1590000 r--p 00000000 fc:06 1615030600 /usr/lib64/libm.so.6
7fffb1590000-7fffb1650000 r-xp 00020000 fc:06 1615030600 /usr/lib64/libm.so.6
7fffb1650000-7fffb16b0000 r--p 000e0000 fc:06 1615030600 /usr/lib64/libm.so.6
7fffb16b0000-7fffb16c0000 r--p 00130000 fc:06 1615030600 /usr/lib64/libm.so.6
7fffb16c0000-7fffb16d0000 rw-p 00140000 fc:06 1615030600 /usr/lib64/libm.so.6
7fffb16d0000-7fffb16e0000 r--p 00000000 fc:06 1615031006 /usr/lib64/libcrypt.so.2.0.0
7fffb16e0000-7fffb1700000 r-xp 00010000 fc:06 1615031006 /usr/lib64/libcrypt.so.2.0.0
7fffb1700000-7fffb1720000 r--p 00030000 fc:06 1615031006 /usr/lib64/libcrypt.so.2.0.0
7fffb1720000-7fffb1730000 r--p 00040000 fc:06 1615031006 /usr/lib64/libcrypt.so.2.0.0
7fffb1730000-7fffb1740000 rw-p 00000000 00:00 0
7fffb1740000-7fffb1750000 r--p 00000000 fc:06 1615031014 /usr/lib64/libgmp.so.10.4.1
7fffb1750000-7fffb17d0000 r-xp 00010000 fc:06 1615031014 /usr/lib64/libgmp.so.10.4.1
7fffb17d0000-7fffb17f0000 r--p 00090000 fc:06 1615031014 /usr/lib64/libgmp.so.10.4.1
7fffb17f0000-7fffb1800000 r--p 000a0000 fc:06 1615031014 /usr/lib64/libgmp.so.10.4.1
7fffb1800000-7fffb1810000 rw-p 000b0000 fc:06 1615031014 /usr/lib64/libgmp.so.10.4.1
7fffb1810000-7fffb1830000 r-xp 00000000 fc:06 1615030899 /usr/lib64/libz.so.1.2.11
7fffb1830000-7fffb1840000 r--p 00010000 fc:06 1615030899 /usr/lib64/libz.so.1.2.11
7fffb1840000-7fffb1850000 rw-p 00020000 fc:06 1615030899 /usr/lib64/libz.so.1.2.11
7fffb1850000-7fffb1890000 r--p 00000000 fc:06 1615030597 /usr/lib64/libc.so.6
7fffb1890000-7fffb1a40000 r-xp 00040000 fc:06 1615030597 /usr/lib64/libc.so.6
7fffb1a40000-7fffb1ab0000 r--p 001f0000 fc:06 1615030597 /usr/lib64/libc.so.6
7fffb1ab0000-7fffb1ac0000 r--p 00250000 fc:06 1615030597 /usr/lib64/libc.so.6
7fffb1ac0000-7fffb1ad0000 rw-p 00260000 fc:06 1615030597 /usr/lib64/libc.so.6
7fffb1ae0000-7fffb1b20000 r--p 00000000 fc:06 1077936030 /builddir/build/BUILD/ruby-3.0.3/libruby.so.3.0.3
7fffb1b20000-7fffb1e10000 r-xp 00040000 fc:06 1077936030 /builddir/build/BUILD/ruby-3.0.3/libruby.so.3.0.3
7fffb1e10000-7fffb1f20000 r--p 00330000 fc:06 1077936030 /builddir/build/BUILD/ruby-3.0.3/libruby.so.3.0.3
7fffb1f20000-7fffb1f30000 ---p 00440000 fc:06 1077936030 /builddir/build/BUILD/ruby-3.0.3/libruby.so.3.0.3
7fffb1f30000-7fffb1f40000 r--p 00440000 fc:06 1077936030 /builddir/build/BUILD/ruby-3.0.3/libruby.so.3.0.3
7fffb1f40000-7fffb1f50000 rw-p 00450000 fc:06 1077936030 /builddir/build/BUILD/ruby-3.0.3/libruby.so.3.0.3
7fffb1f50000-7fffb1f60000 rw-p 00000000 00:00 0
7fffb1f60000-7fffb1f80000 r--p 00000000 00:00 0 [vvar]
7fffb1f80000-7fffb1f90000 r-xp 00000000 00:00 0 [vdso]
7fffb1f90000-7fffb1fa0000 r--p 00000000 fc:06 1615030592 /usr/lib64/ld64.so.2
7fffb1fa0000-7fffb1ff0000 r-xp 00010000 fc:06 1615030592 /usr/lib64/ld64.so.2
7fffb1ff0000-7fffb2000000 r--p 00060000 fc:06 1615030592 /usr/lib64/ld64.so.2
7fffb2000000-7fffb2010000 r--p 00060000 fc:06 1615030592 /usr/lib64/ld64.so.2
7fffb2010000-7fffb2020000 rw-p 00070000 fc:06 1615030592 /usr/lib64/ld64.so.2
7fffd3830000-7fffd4030000 rw-p 00000000 00:00 0 [stack]
test_string.rb .
test_struct.rb .
test_syntax.rb ............................................................................................................................................................
test_thread.rb .................................................
Fiber count: 10000 (skipping)
#1282 test_ractor.rb:1405:in `<top (required)>':
workers = (0...8).map do
Ractor.new do
loop do
10_000.times.map { Object.new }
Ractor.yield Time.now
end
end
end
1_000.times { idle_worker, tmp_reporter = Ractor.select(*workers) }
"ok"
#=> "" (expected "ok")
FAIL 1/1489 tests failed
make: *** [uncommon.mk:767: yes-btest-ruby] Error 1
... snip ...
</code></pre>
<p>It reminds me <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: Segmentation fault when yielding values from Ractors during GC sweeping (Closed)" href="https://bugs.ruby-lang.org/issues/18117">#18117</a>, but that should be fixed, right?</p> Ruby master - Bug #18359 (Open): [Windows MinGW] warning Please include winsock2.h before windows.hhttps://bugs.ruby-lang.org/issues/183592021-11-23T17:05:03ZMSP-Greg (Greg L)
<p>Compile warning from <code>include/ruby/win32.h</code>? Appears with both MINGW64 & UCRT64 builds.</p>
<pre><code>In file included from D:/ruby-mingw/include/ruby-3.1.0/ruby/win32.h:41,
from D:/ruby-mingw/include/ruby-3.1.0/ruby/internal/dosish.h:38,
from D:/ruby-mingw/include/ruby-3.1.0/ruby/defines.h:78,
from D:/ruby-mingw/include/ruby-3.1.0/ruby/ruby.h:25,
from D:/ruby-mingw/include/ruby-3.1.0/ruby.h:38,
from ../../../../ext/nokogiri/nokogiri.h:68,
from ../../../../ext/nokogiri/gumbo.c:30:
C:/msys64/mingw64/x86_64-w64-mingw32/include/winsock2.h:15:2: warning: #warning Please include winsock2.h before windows.h [-Wcpp]
15 | #warning Please include winsock2.h before windows.h
| ^~~~~~~
</code></pre> Ruby master - Bug #18132 (Open): TODO: fix ccan/list thread safetyhttps://bugs.ruby-lang.org/issues/181322021-08-25T07:19:47Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<p>This library does not consider multi-threading at all.<br>
Callers must consider it instead.<br>
AFAIK, VM list has a problem, and others may.</p> Ruby master - Bug #18080 (Open): Syntax error on one-line pattern matchinghttps://bugs.ruby-lang.org/issues/180802021-08-17T05:54:42Zko1 (Koichi Sasada)
<p>One line pattern matching with a method return value with parameters which are not surrounded by parenthesis raises syntax error.<br>
I think it is not intentional, but nobu said it's hard to support because of parse.y limitation.</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="nb">p</span> <span class="k">do</span>
<span class="k">end</span> <span class="o">=></span> <span class="n">a</span>
<span class="nb">p</span> <span class="n">a</span> <span class="c1">#=> nil</span>
<span class="nb">p</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span> <span class="k">do</span>
<span class="k">end</span> <span class="o">=></span> <span class="n">a</span>
<span class="nb">p</span> <span class="n">a</span> <span class="c1">#=> 1</span>
<span class="nb">p</span> <span class="mi">1</span> <span class="k">do</span>
<span class="k">end</span> <span class="o">=></span> <span class="n">a</span>
<span class="c1">#=> </span>
<span class="c1"># syntax error, unexpected =>, expecting end-of-input</span>
<span class="c1"># end => a</span>
<span class="c1"># ^~</span>
<span class="nb">p</span> <span class="mi">1</span> <span class="k">do</span>
<span class="k">end</span> <span class="k">in</span> <span class="n">a</span>
<span class="c1">#=> </span>
<span class="c1"># syntax error, unexpected `in', expecting end-of-input</span>
<span class="c1"># end in a</span>
<span class="c1"># ^~</span>
</code></pre> Ruby master - Bug #18013 (Open): Unexpected results when mxiing negated character classes and cas...https://bugs.ruby-lang.org/issues/180132021-06-29T08:55:22Zjirkamarsik (Jirka Marsik)
<pre><code>irb(main):001:0> /[^a-c]/i.match("A")
=> nil
irb(main):002:0> /[[^a-c]]/i.match("A")
=> #<MatchData "A">
</code></pre>
<p>The two regular expressions above match different strings, because the character classes denote different sets of characters. In order for <code>/[^a-c]/i</code> to produce correct results, Oniguruma provided a fix that can still be easily seen in the code as it is hidden behind an always-on preprocessor flag (<code>CASE_FOLD_IS_APPLIED_INSIDE_NEGATIVE_CCLASS</code>, <a href="https://github.com/ruby/ruby/blob/9eae8cdefba61e9e51feb30a4b98525593169666/regparse.c#L5528" class="external">https://github.com/ruby/ruby/blob/9eae8cdefba61e9e51feb30a4b98525593169666/regparse.c#L5528</a>). The idea of the fix is to first case-fold a character class and only then apply the negation (essentially moving the case-fold operator <em>inside</em> the negation).</p>
<p>In the case of our first regular expression, <code>[a-c]</code> is case-folded into <code>[a-cA-C]</code> and that is then inverted into <code>[^a-cA-C]</code>, which is the expected result. However, this case-folding logic is currently only being applied to the top-most character class and so if we use a nested negated character class, the order of the operations will be switched.</p>
<p>With our second regular expression, <code>[a-c]</code> will first be negated to yield <code>[^a-c]</code>, which will then be case-folded into <code>.</code>, the set of all characters (since <code>[^a-c]</code> contains <code>A-C</code>, which case-fold into <code>a-c</code>).</p>
<p>A way to fix this would be to apply case-folding for nested character classes as well, so that the nested character classes behave the same as the top-most character class. Then, we would get the same semantics for both expressions.</p> Ruby master - Bug #18009 (Open): Regexps \w and \W with /i option and /u option produce inconsist...https://bugs.ruby-lang.org/issues/180092021-06-28T09:09:37Zjirkamarsik (Jirka Marsik)
<p>This is a follow up to <a href="https://bugs.ruby-lang.org/issues/4044" class="external">issue 4044</a>. Its fix (<a href="https://github.com/k-takata/Onigmo/issues/4" class="external">https://github.com/k-takata/Onigmo/issues/4</a>) handled the cases that were reported in the original issue, but there are other cases, which were omitted and now produce inconsistent results.</p>
<p>If the <code>\w</code> character set is used inside a nested negated character class, it will not be picked up by the part of the character class analyzer that's responsible for limiting the case-folding of certain character sets (like <code>\w</code> and <code>\W</code>) across the ASCII boundary. We then end up with the situation where <code>/[^\w]/iu</code> and <code>/[[^\w]]/iu</code> match different sets of characters.</p>
<pre><code>irb(main):001:0> ("a".."z").to_a.join.scan(/\W/iu)
=> []
irb(main):002:0> ("a".."z").to_a.join.scan(/[^\w]/iu)
=> []
irb(main):003:0> ("a".."z").to_a.join.scan(/[[^\w]]/iu)
=> ["k", "s"]
</code></pre>
<p>This can also be demonstrated using the inverted matcher:</p>
<pre><code>irb(main):004:0> ("a".."z").to_a.join.scan(/\w/iu).length
=> 26
irb(main):005:0> ("a".."z").to_a.join.scan(/[^[^\w]]/iu).length
=> 24
</code></pre>
<p>A similar issue also arises when using character class intersection. The idea behind the pattern compiler's analysis is that characters are allowed to case-fold across the ASCII boundary only if they are included in the character class by some other means than just being included in <code>\w</code> (or in one of several other character sets which have special treatment). Therefore, in the below, <code>/[\w]/iu</code> will not match the Kelvin sign <code>\u212a</code>, because that would mean crossing the ASCII boundary from <code>k</code> to <code>\u212a</code>. However, <code>/[kx]/iu</code> will match the Kelvin sign, because the <code>k</code> was not contributed by <code>\w</code> and therefore is not subject to the ASCII boundary restriction (we have to use <code>/[kx]/iu</code> instead of <code>/[k]/iu</code> in our examples, or else the pattern analyzer would replace <code>[k]</code> with <code>k</code> and follow a different code path).</p>
<pre><code>irb(main):006:0> /[\w]/iu.match("\u212a")
=> nil
irb(main):007:0> /[kx]/iu.match("\u212a")
=> #<MatchData "K">
</code></pre>
<p>The problem then is when we perform an intersection of these two character sets. Since <code>[kx]</code> is a subset of <code>\w</code>, we would expect their intersection to behave the same as <code>[kx]</code>, but that is not the case.</p>
<pre><code>irb(main):008:0> /[\w&&kx]/i.match("\u212a")
=> nil
</code></pre>
<p>The underlying issue in these cases is the manner in which the <code>ascCc</code> character set is computed during the parsing of character classes. The <code>ascCc</code> character set should contain all characters of the character class except those which were contributed by <code>\w</code> and similar character sets. This is done in a way that these character sets are essentially ignored in the calculation of <code>ascCc</code>, which works well for set union and top-most negation (which is handled explicitly), but it doesn't handle nested set negation and set intersection.</p> Ruby master - Bug #18002 (Open): s390x: Tests failing without LC_ALL envhttps://bugs.ruby-lang.org/issues/180022021-06-21T10:45:16Zjaruga (Jun Aruga)
<p>The following failures happened in RubyCI on our s390x Ubuntu focal server.<br>
On the server, RubyCI (ruby/chkbuild) is executed with LC_ALL not set, by cron.<br>
I found the unset <code>LC_ALL</code> causes the failures on the s390x server. This does not happen on x86_64 Fedora 33 on my local machine.</p>
<p>I was able to reproduce the failures on the master branch <code>dbd1887d04f5ff7c2a1f0a27d7339133a</code> on the server.</p>
<a name="Reproducer"></a>
<h2 >Reproducer<a href="#Reproducer" class="wiki-anchor">¶</a></h2>
<pre><code>$ uname -m
s390x
$ autoconf
$ ./configure \
--prefix=${HOME}/local/ruby-master-9d96837 \
--enable-shared
$ make
</code></pre>
<h3>Without <code>LC_ALL</code>
</h3>
<p>Then run the tests without <code>LC_ALL</code>.</p>
<pre><code>$ unset LC_ALL
$ echo $LC_ALL
<= empty
</code></pre>
<pre><code>$ make test-all TESTS="-v test/ruby/test_file.rb -n TestFile#test_realpath_encoding"
Run options:-
--seed=85060
"--ruby=./miniruby -I./lib -I. -I.ext/common ./tool/runruby.rb --extout=.ext -- --disable-gems"
--excludes-dir=./test/excludes
--name=!/memory_leak/
-v
-n
TestFile#test_realpath_encoding
# Running tests:
[1/0] TestFile#test_realpath_encoding = 0.00 s
1) Failure:
TestFile#test_realpath_encoding [/home/jaruga/git/ruby/ruby2/test/ruby/test_file.rb:284]:
<"/tmp/rubytest-realpath20210621-3365652-za1wql/A\u0391\u0410\u0531\u10A0\u05D0\u2C00\u3042"> expected but was
<"/tmp/rubytest-realpath20210621-3365652-za1wql/A\u00CE\u0091\u00D0\u0090\u00D4\u00B1\u00E1\u0082\u00A0\u00D7\u0090\u00E2\u00B0\u0080\u00E3\u0081\u0082">.
Finished tests in 0.007217s, 138.5674 tests/s, 692.8372 assertions/s.
1 tests, 5 assertions, 1 failures, 0 errors, 0 skips
ruby -v: ruby 3.1.0dev (2021-06-18T10:13:36Z master 9d96837dbd) [s390x-linux]
make: *** [uncommon.mk:803: yes-test-all] Error 1
</code></pre>
<pre><code>$ make test-all TESTS="-v test/irb/test_context.rb -n TestIRB::TestContext#test_eval_input_with_invalid_byte_sequence_exception"
Run options:-
--seed=74635
"--ruby=./miniruby -I./lib -I. -I.ext/common ./tool/runruby.rb --extout=.ext -- --disable-gems"
--excludes-dir=./test/excludes
--name=!/memory_leak/
-v
-n
TestIRB::TestContext#test_eval_input_with_invalid_byte_sequence_exception
# Running tests:
[1/0] TestIRB::TestContext#test_eval_input_with_invalid_byte_sequence_exception = 0.00 s
1) Failure:
TestIRB::TestContext#test_eval_input_with_invalid_byte_sequence_exception [/home/jaruga/git/ruby/ruby2/test/irb/test_context.rb:505]:
Expected /\(irb\):1:in `fuga': A\\xF3B \(RuntimeError\)\n/
to match
"(irb):1:in `fuga': A�B (RuntimeError)\n"+
"\tfrom (irb):1:in `hoge'\n"+
"\tfrom (irb):1:in `<main>'\n"
after 1 patterns with 0 characters.
Finished tests in 0.007640s, 130.8819 tests/s, 785.2916 assertions/s.
1 tests, 6 assertions, 1 failures, 0 errors, 0 skips
ruby -v: ruby 3.1.0dev (2021-06-18T10:13:36Z master 9d96837dbd) [s390x-linux]
make: *** [uncommon.mk:803: yes-test-all] Error 1
</code></pre>
<h3>With <code>export LC_ALL=C</code>
</h3>
<p>On the <code>export LC_ALL=C</code> (<code>LC_ALL=C</code> without <code>export</code> is not enough to pass the tests)</p>
<pre><code>$ export LC_ALL=C
$ echo $LC_ALL
C
</code></pre>
<pre><code>$ make test-all TESTS="-v test/ruby/test_file.rb -n TestFile#test_realpath_encoding"
Run options:
--seed=89696
"--ruby=./miniruby -I./lib -I. -I.ext/common ./tool/runruby.rb --extout=.ext -- --disable-gems"
--excludes-dir=./test/excludes
--name=!/memory_leak/
-v
-n
TestFile#test_realpath_encoding
# Running tests:
[1/0] TestFile#test_realpath_encoding = 0.00 s
Finished tests in 0.004715s, 212.0691 tests/s, 1060.3455 assertions/s.
1 tests, 5 assertions, 0 failures, 0 errors, 0 skips
ruby -v: ruby 3.1.0dev (2021-06-18T10:13:36Z master 9d96837dbd) [s390x-linux]
</code></pre>
<pre><code>$ make test-all TESTS="-v test/irb/test_context.rb -n TestIRB::TestContext#test_eval_input_with_invalid_byte_sequence_exception"
Run options:
--seed=67965
"--ruby=./miniruby -I./lib -I. -I.ext/common ./tool/runruby.rb --extout=.ext -- --disable-gems"
--excludes-dir=./test/excludes
--name=!/memory_leak/
-v
-n
TestIRB::TestContext#test_eval_input_with_invalid_byte_sequence_exception
# Running tests:
[1/0] TestIRB::TestContext#test_eval_input_with_invalid_byte_sequence_exception = 0.00 s
Finished tests in 0.007877s, 126.9448 tests/s, 761.6689 assertions/s.
1 tests, 6 assertions, 0 failures, 0 errors, 0 skips
ruby -v: ruby 3.1.0dev (2021-06-18T10:13:36Z master 9d96837dbd) [s390x-linux]
</code></pre>
<a name="Possible-Solution"></a>
<h2 >Possible Solution<a href="#Possible-Solution" class="wiki-anchor">¶</a></h2>
<p>Fix the tests not depending on the external LC_ALL condition.</p> Ruby master - Bug #17999 (Open): TestMethod#test_zsuper intermittent timeout error on raspbian10-...https://bugs.ruby-lang.org/issues/179992021-06-18T01:33:18Zxtkoba (Tee KOBAYASHI)
<p>In <a href="http://rubyci.s3.amazonaws.com/raspbian10-aarch64/ruby-master/log/20210617T223805Z.log.html.gz" class="external">http://rubyci.s3.amazonaws.com/raspbian10-aarch64/ruby-master/log/20210617T223805Z.log.html.gz</a> the following error message is observed:</p>
<pre><code> 1) Error:
TestMethod#test_zsuper:
Timeout::Error: execution of assert_separately expired timeout (30.0 sec)
pid 16029 killed by SIGTERM (signal 15)
|
/home/chkbuild/build/20210617T223805Z/ruby/test/ruby/test_inlinecache.rb:37:in `test_zsuper'
</code></pre>
<p>This seems to appear intermittently.</p>
<p>As for test timeout on aarch64-linux we have other open issues: <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: TestThreadQueue#test_thr_kill is flaky on AArch64 (Closed)" href="https://bugs.ruby-lang.org/issues/16493">#16493</a>, <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: TestThread#test_signal_at_join fails on aarch64 (Closed)" href="https://bugs.ruby-lang.org/issues/16920">#16920</a>, <a class="issue tracker-1 status-1 priority-4 priority-default" title="Bug: make notes and make test fail with Ruby3.0.1p64 RaspberryPI 4B Ubuntu 20.10 ARM64 (Open)" href="https://bugs.ruby-lang.org/issues/17792">#17792</a>. I'm not sure if they are relevant to one another in any way.</p> Ruby master - Bug #17925 (Open): Pattern matching syntax using semicolon one-linehttps://bugs.ruby-lang.org/issues/179252021-05-29T15:26:37Zkoic (Koichi ITO)koic.ito@gmail.com
<a name="Summary"></a>
<h2 >Summary<a href="#Summary" class="wiki-anchor">¶</a></h2>
<p>There are the following differences between <code>case ... when</code> and<code> case ... in</code>. Is this an expected behavior?</p>
<pre><code class="console syntaxhl" data-language="console"><span class="go">% ruby -v
ruby 3.1.0dev (2021-05-28T16:34:27Z master e56ba6231f) [x86_64-darwin19]
</span><span class="gp">% ruby -ce 'case expression when 42;</span><span class="w"> </span>end<span class="s1">'
</span><span class="go">Syntax OK
</span><span class="gp">% ruby -ce 'case expression in 42;</span><span class="w"> </span>end<span class="s1">'
</span><span class="go">-e:1: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!
-e:1: syntax error, unexpected `end', expecting `when'
</span><span class="gp">case expression in 42;</span><span class="w"> </span>end
</code></pre>
<p>So, I have two concerns.</p>
<ul>
<li>Since the pattern matching syntax is different from <code>case ... when</code>, can't user write semicolon one-line <code>case ... in</code> in the same semicolon one-line as <code>case ... when</code>?</li>
<li>Does <code>case expression in 42; end</code> display an experimental warning of one-line pattern matching. Right?</li>
</ul>
<p>This is reproduced in Ruby 3.1.0-dev and Ruby 3.0.1.</p>
<a name="Additional-Information"></a>
<h2 >Additional Information<a href="#Additional-Information" class="wiki-anchor">¶</a></h2>
<p>NOTE 1: I understand that only syntax that doesn't use <code>case</code> and <code>end</code> is experimental one-line pattern matching syntax.</p>
<pre><code>% ruby -ce 'expression in 42'
-e:1: warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!
Syntax OK
</code></pre>
<p>NOTE 2: The syntax is OK if a semicolon is used between <code>expression</code> and <code>in</code>. But <code>case ... when</code> is a valid syntax to omit.</p>
<pre><code>% ruby -e ruby -ce 'case expression; in 42; end'
Syntax OK
</code></pre> Ruby master - Bug #17774 (Open): Quantified empty group causes regex to failhttps://bugs.ruby-lang.org/issues/177742021-04-04T08:08:53ZDavidebyzero (David Ellsworth)
<p>The regex <code>^((x*)(?=\2$))*x$</code> matches powers of 2 in unary, expressed as strings of <code>x</code> characters whose length is the number.</p>
<p>Adding an empty group <code>()</code> in the middle of it should have no effect on its operation, and indeed it does not. <code>^((x*)()(?=\2$))*x$</code> still matches powers of 2 just fine.<br>
Quantifying that empty group, <code>(){4}</code>, should still have no effect. And indeed, <code>^((x*)(){4}(?=\2$))*x$</code> still matches powers of 2. But quantify that to <code>(){5}</code>, and suddenly it fails.</p>
<p>The following command line should print <code>1</code>, but instead prints nothing:</p>
<pre><code>ruby -e 'print 1 if "x"*32 =~ /^((x*)(){5}(?=\2$))*x$/'
</code></pre>
<p>However this one does print <code>1</code>:</p>
<pre><code>ruby -e 'print 1 if "x"*32 =~ /^((x*)(){4}(?=\2$))*x$/'
</code></pre>
<p>Bug found to occur on <a href="https://tio.run/" class="external">Try It Online</a>: <code>ruby 2.5.5p157 (2019-03-15 revision 67260) [x86_64-linux]</code><br>
Bug confirmed to happen on my own machine: <code>ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-msys]</code></p>
<p>Solving the challenge <a href="https://codegolf.stackexchange.com/questions/211840/is-that-number-a-two-bit-number%ef%b8%8f/222792#222792" class="external">Is that number a Two Bit Number™️?</a> on Code Golf Stack Exchange is what led me to discover this bug.</p> Ruby master - Bug #17624 (Open): Ractor.receive is not thread-safehttps://bugs.ruby-lang.org/issues/176242021-02-13T02:14:53Zdazuma (Daniel Azuma)dazuma@gmail.com
<p>It does not seem to be possible to have multiple blocked <code>Ractor.receive</code> calls concurrently in the same Ractor (but different threads). One may succeed but the others will hang indefinitely, even if messages are present in the queue.</p>
<p>Example code below. It does the following:</p>
<ol>
<li>Starts a Ractor <code>r1</code> that spawns two "listener threads". Each thread calls <code>Ractor.receive</code>, which blocks waiting for messages.</li>
<li>The main Ractor pauses briefly to ensure that the threads have started, and then sends two messages to the Ractor <code>r1</code>, with the expectation that each thread will receive one of them.</li>
<li>What actually happens is, the <code>Ractor.receive</code> call in <em>one</em> of the threads will pick a message and return. However, the <code>Ractor.receive</code> call in the other thread remains blocked, even though the second message is in the queue.</li>
<li>Ractor <code>r1</code>, after a pause to ensure that both messages have been sent, issues another <code>Ractor.receive</code> call. This call does not block (because the second message is in the queue), and successfully returns the message. Meanwhile, the second thread's <code>Ractor.receive</code> call remains blocked. This demonstrates that the second message has been sent successfully and is receivable, even though the second thread still hasn't returned it. It appears that the second thread's receive call is in a bad state.</li>
</ol>
<pre><code>r1 = Ractor.new do
# Start two listener threads
t1 = Thread.new do
puts "T1 received #{Ractor.receive}"
end
t2 = Thread.new do
puts "T2 received #{Ractor.receive}"
end
# Pause to ensure that both messages have been sent.
# (One of the messages will have been picked up by a
# thread, but the other remains in the queue.)
sleep(3)
# Receive the second message. This will succeed, even
# though the second thread is still blocked.
puts "Later received #{Ractor.receive}"
# Wait for the threads to finish.
# This will never complete because one of the threads will not
# receive the second message, and is still blocking.
[t1, t2].each(&:join)
:ok
end
# Make sure both receive calls are blocking
sleep(1)
# Send two messages.
r1.send(1)
r1.send(2)
# This never returns because the ractor never completes.
puts r1.take
</code></pre>
<p>This happens both in 3.0.0 release and on 3.1.0 head.</p>
<pre><code>% ruby -v
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-darwin20]
</code></pre>
<pre><code>% ruby -v
ruby 3.1.0dev (2021-02-09T13:22:37Z master e7a831de8e) [x86_64-darwin20]
</code></pre>
<p>Notes:</p>
<ul>
<li>This also happens when using <code>receive_if</code>.</li>
<li>I would expect this use case to be common when writing a Ractor that contains multiple thread-safe "workers". (This was in fact the use case I was trying to implement when I encountered this issue.) Thus, if we decide this is working as intended, we should document it, and possibly suggest to users that they write their Ractor to funnel communication through a single dedicated thread.</li>
</ul> Ruby master - Bug #17617 (Open): When a Ractor's incoming port is closed, Ractor.receive_if does ...https://bugs.ruby-lang.org/issues/176172021-02-09T16:24:27Zdazuma (Daniel Azuma)dazuma@gmail.com
<p>If Ractor#close_incoming is called on a Ractor, any pending Ractor.receive call will raise Ractor::ClosedError. However, any pending Ractor.receive_if call will not; instead, it never returns.</p>
<pre><code>r1 = Ractor.new do
Ractor.receive
rescue => e
e
end
r1.close_incoming
result = r1.take
puts "**** taken: #{result}" # displays the Ractor::ClosedError
r2 = Ractor.new do
Ractor.receive_if { true }
puts "**** never reaches here"
rescue => e
puts "**** never reaches here"
e
end
r2.close_incoming
puts "**** hangs here..."
r2.take
puts "**** never reaches here"
</code></pre>
<p>This was tested against both 3.0.0 and 3.1.0 head, with the same result.</p>
<pre><code>% ruby -v
ruby 3.1.0dev (2021-02-09T13:22:37Z master e7a831de8e) [x86_64-darwin20]
</code></pre>
<pre><code>% ruby -v
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-darwin20
</code></pre>
<p>I have also tried including sleep statements to force the Ractor.receive_if to execute both before and after the Ractor#close_incoming call. The result is the same either way. receive_if hangs regardless of whether the incoming port is already closed when receive_if is invoked, or whether the port is closed while the receive_if is already blocking.</p> Ruby master - Bug #17506 (Open): Ractor isolation broken by ThreadGrouphttps://bugs.ruby-lang.org/issues/175062021-01-03T20:05:43Zmarcandre (Marc-Andre Lafortune)marcandre-ruby-core@marc-andre.ca
<p>Ractors currently share the ThreadGroup.</p>
<p>This doesn't seem very useful as there is no possible communication between the Threads of different Ractors.</p>
<p>It is also an isolation error:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="no">ThreadGroup</span><span class="p">.</span><span class="nf">attr_accessor</span> <span class="ss">:foo</span>
<span class="n">var</span> <span class="o">=</span> <span class="no">Thread</span><span class="p">.</span><span class="nf">current</span><span class="p">.</span><span class="nf">group</span><span class="p">.</span><span class="nf">foo</span> <span class="o">=</span> <span class="p">[</span><span class="ss">:example</span><span class="p">]</span>
<span class="no">Ractor</span><span class="p">.</span><span class="nf">new</span> <span class="p">{</span> <span class="no">Thread</span><span class="p">.</span><span class="nf">current</span><span class="p">.</span><span class="nf">group</span><span class="p">.</span><span class="nf">foo</span> <span class="o"><<</span> <span class="p">[</span><span class="ss">:oops</span><span class="p">]</span> <span class="p">}.</span><span class="nf">take</span>
<span class="n">var</span> <span class="c1"># => [:example, [:oops]]</span>
</code></pre>
<p>Should <code>Ractor.new</code> create a new <code>ThreadGroup</code>? Should <code>ThreadGroup</code> not have (non-shareable) instance variables? Or should <code>Ractor.new { Thread.current.group }.take</code> be <code>nil</code>? See also <a href="https://bugs.ruby-lang.org/issues/17505" class="external">https://bugs.ruby-lang.org/issues/17505</a> about <code>nil</code>.</p>
<p>Note that <code>Ractor</code> respects the <code>ThreadGroup</code>'s state:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="no">Thread</span><span class="p">.</span><span class="nf">current</span><span class="p">.</span><span class="nf">group</span><span class="p">.</span><span class="nf">enclose</span>
<span class="no">Ractor</span><span class="p">.</span><span class="nf">new</span> <span class="p">{</span> <span class="no">Thread</span><span class="p">.</span><span class="nf">current</span><span class="p">.</span><span class="nf">group</span><span class="p">.</span><span class="nf">add</span><span class="p">(</span><span class="no">Thread</span><span class="p">.</span><span class="nf">current</span><span class="p">)</span> <span class="p">}.</span><span class="nf">take</span> <span class="c1"># => can't move to the enclosed thread group</span>
<span class="no">Thread</span><span class="p">.</span><span class="nf">current</span><span class="p">.</span><span class="nf">group</span><span class="p">.</span><span class="nf">freeze</span>
<span class="no">Ractor</span><span class="p">.</span><span class="nf">new</span> <span class="p">{}</span> <span class="c1"># => ThreadError (can't start a new thread (frozen ThreadGroup))</span>
</code></pre>
<p>I am not sure what is the best behavior as I don't have enough experience with how ThreadGroups are used, especially enclosed ThreadGroups.</p> Ruby master - Bug #17420 (Open): Unsafe mutation of $" when doing non-RubyGems require in Ractorhttps://bugs.ruby-lang.org/issues/174202020-12-21T18:31:49ZEregon (Benoit Daloze)
<p>With an empty file <code>a.rb</code>:</p>
<pre><code>$ ruby --disable-gems -e 'Ractor.new { puts $" }.take'
-e:1:in `block in <main>': can not access global variables $" from non-main Ractors (RuntimeError)
</code></pre>
<p>That is expected, given the rules for global variables.</p>
<pre><code>ruby --disable-gems -e 'Ractor.new { require "./a.rb"; }.take; p $"'
[... , "/home/eregon/a.rb"]
</code></pre>
<p>Is it OK that the Ractor can do <code>require</code>, which does modify <code>$"</code>?</p>
<p>I think it's not, and it might lead to segfaults if e.g. the main Ractor mutates <code>$"</code> in parallel to some other Ractor doing <code>require</code>.</p>
<p>Probably <code>require</code> needs to be forbidden in non-main Ractors (it does mutate <code>$"</code>, so it's logical), or there needs to be always VM-global synchronization on any access to <code>$"</code> (otherwise, segfaults are possible).<br>
The latter doesn't seem reasonable, especially when considering the user might do <code>$".each { ... }</code>.</p>
<hr>
<p>Note that RubyGems' <code>require</code> does not work on non-main Ractors (pretty much expected given it depends on a lot of global state):</p>
<pre><code>$ ruby -e 'Ractor.new { require "./a.rb"; }.take'
<internal:/home/eregon/prefix/ruby-master/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:37:in `require': can not access non-shareable objects in constant Kernel::RUBYGEMS_ACTIVATION_MONITOR by non-main ractor. (NameError)
</code></pre>
<p>This probably also has consequences for <code>autoload</code>.<br>
Maybe the <code>zeitwerk</code> gem can help with the mode to resolve all autoload at once.</p> Ruby master - Bug #17359 (Open): Ractor copy mode is not Ractor-safehttps://bugs.ruby-lang.org/issues/173592020-12-01T08:29:37Zmarcandre (Marc-Andre Lafortune)marcandre-ruby-core@marc-andre.ca
<p>It should not be possible to mutate an object across Ractors, but the copy mode allows it currently:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="k">class</span> <span class="nc">Foo</span>
<span class="nb">attr_accessor</span> <span class="ss">:x</span>
<span class="k">def</span> <span class="nf">initialize_copy</span><span class="p">(</span><span class="o">*</span><span class="p">)</span>
<span class="vg">$last</span> <span class="o">=</span> <span class="nb">self</span>
<span class="k">super</span>
<span class="k">end</span>
<span class="k">end</span>
<span class="n">o</span> <span class="o">=</span> <span class="no">Foo</span><span class="p">.</span><span class="nf">new</span>
<span class="n">o</span><span class="p">.</span><span class="nf">x</span> <span class="o">=</span> <span class="mi">42</span>
<span class="n">r</span> <span class="o">=</span> <span class="no">Ractor</span><span class="p">.</span><span class="nf">new</span><span class="p">(</span><span class="n">o</span><span class="p">)</span> <span class="k">do</span> <span class="o">|</span><span class="n">copy</span><span class="o">|</span>
<span class="nb">puts</span> <span class="n">copy</span><span class="p">.</span><span class="nf">x</span> <span class="c1"># => 42</span>
<span class="no">Ractor</span><span class="p">.</span><span class="nf">yield</span> <span class="ss">:sync</span>
<span class="no">Ractor</span><span class="p">.</span><span class="nf">yield</span> <span class="ss">:sync</span>
<span class="nb">puts</span> <span class="n">copy</span><span class="p">.</span><span class="nf">x</span> <span class="c1"># => 666</span>
<span class="k">end</span>
<span class="n">r</span><span class="p">.</span><span class="nf">take</span> <span class="c1"># => :sync</span>
<span class="vg">$last</span><span class="p">.</span><span class="nf">x</span> <span class="o">=</span> <span class="mi">666</span>
<span class="n">r</span><span class="p">.</span><span class="nf">take</span> <span class="c1"># => :sync</span>
<span class="n">r</span><span class="p">.</span><span class="nf">take</span>
</code></pre>
<p>Maybe the <code>copy</code> object should be marked as moved?</p> Ruby master - Bug #17142 (Open): Ruby fails to build in AIX https://bugs.ruby-lang.org/issues/171422020-09-02T14:05:19ZAyappan (Ayappan Perumal)
<p>Ruby fails to build in AIX in 64bit mode.</p>
<p>This commit <a href="https://github.com/ruby/ruby/commit/f47c38245ff6976c5d1fc27a79f239bba00fc333" class="external">https://github.com/ruby/ruby/commit/f47c38245ff6976c5d1fc27a79f239bba00fc333</a> essentially broke the 64bit build.</p>
<p>The asm code is not applicable for AIX it seems. Probably we need to add a !defined(_AIX) check on this.</p> Ruby master - Bug #16905 (Open): Ruby required to build Ruby on Haiku?https://bugs.ruby-lang.org/issues/169052020-05-20T17:55:21Zextrowerk (Zoltán Mizsei)
<p>Building Ruby on Haiku results in the following error:</p>
<pre><code>executable host ruby is required. use --with-baseruby option.
</code></pre>
<p>Build environment:</p>
<pre><code>~> uname -a
Haiku shredder 1 hrev54197 May 14 2020 06:44:52 x86_64 x86_64 Haiku
</code></pre>
<p>Current recipe and patch set:<br>
<a href="https://github.com/extrowerk/haikuports/tree/ruby_2.7.1/dev-lang/ruby" class="external">https://github.com/extrowerk/haikuports/tree/ruby_2.7.1/dev-lang/ruby</a></p> Ruby master - Bug #16810 (Open): ruby segfaults on s390x with musl libchttps://bugs.ruby-lang.org/issues/168102020-04-23T08:49:26Zncopa (Natanael Copa)
<p>When trying to build mruby-2.1.0 ruby segfaults when running <code>ruby ./minirake -v</code>.</p>
<p>I was able to get a backtrace with gdb:</p>
<pre><code>Program received signal SIGSEGV, Segmentation fault.
vm_call_cfunc_with_frame (empty_kw_splat=0, cd=0x2aa0009f108, calling=<optimized out>, reg_cfp=0x3fffd9fea70,
ec=0x3fffb8d45e8) at vm_insnhelper.c:2505
2505 vm_insnhelper.c: No such file or directory.
(gdb) bt
#0 vm_call_cfunc_with_frame (empty_kw_splat=0, cd=0x2aa0009f108, calling=<optimized out>, reg_cfp=0x3fffd9fea70,
ec=0x3fffb8d45e8) at vm_insnhelper.c:2505
#1 vm_call_cfunc (ec=0x3fffb8d45e8, reg_cfp=0x3fffd9fea70, calling=<optimized out>, cd=0x2aa0009f108)
at vm_insnhelper.c:2539
#2 0x000003fffdd79578 in vm_call_method (ec=0x3fffb8d45e8, cfp=0x3fffd9fea70, calling=0x3ffffffb028, cd=0x2aa00583490)
at vm_insnhelper.c:3026
#3 0x000003fffdd5e452 in vm_sendish (ec=0x3fffb8d45e8,
ec@entry=<error reading variable: value has been optimized out>, reg_cfp=reg_cfp@entry=0x3fffd9fea70,
cd=0x2aa00583490, block_handler=block_handler@entry=0,
method_explorer=method_explorer@entry=0x3fffdd66568 <vm_search_method_wrap>) at vm_insnhelper.c:4023
#4 0x000003fffdd6e0a2 in vm_exec_core (ec=<optimized out>, ec@entry=0x0, initial=initial@entry=0) at insns.def:801
#5 0x000003fffdd71fc8 in rb_vm_exec (ec=ec@entry=0x2aa00002a50, mjit_enable_p=mjit_enable_p@entry=1) at vm.c:1929
#6 0x000003fffdd72810 in invoke_block (ec=ec@entry=0x2aa00002a50, iseq=iseq@entry=0x2aa00585f50,
self=self@entry=2929175261440, cref=cref@entry=0x0, type=572653569, opt_pc=0, captured=<optimized out>)
at vm.c:1044
#7 0x000003fffdd729a8 in invoke_iseq_block_from_c (me=0x0, is_lambda=<optimized out>, cref=0x0,
passed_block_handler=4398011476064, kw_splat=-17920, argv=0x3ffffffb5b8, argc=1, self=2929175261440,
captured=0x3fffd9feb30, ec=0x2aa00002a50) at vm.c:1116
#8 invoke_block_from_c_bh (ec=ec@entry=0x2aa00002a50, block_handler=<optimized out>, argc=argc@entry=1,
argv=argv@entry=0x3ffffffb5b8, kw_splat=kw_splat@entry=0, passed_block_handler=0, cref=0x0,
is_lambda=<optimized out>, force_blockarg=0) at vm.c:1134
#9 0x000003fffdd73152 in vm_yield (kw_splat=0, argv=0x3ffffffb5b8, argc=1, ec=0x2aa00002a50) at vm.c:1179
#10 rb_yield_0 (argc=argc@entry=1, argv=argv@entry=0x3ffffffb5b8) at vm_eval.c:1227
#11 0x000003fffdd73184 in rb_yield_1 (val=<optimized out>) at vm_eval.c:1233
#12 0x000003fffdd731bc in rb_yield (val=<optimized out>) at vm_eval.c:1243
#13 0x000003fffdbbb6a0 in rb_ary_each (ary=2929175260720) at array.c:2135
#14 0x000003fffdd6376a in vm_call_cfunc_with_frame (empty_kw_splat=<optimized out>, cd=0x2aa0008e678,
calling=<optimized out>, reg_cfp=0x3fffd9feae0, ec=0x2aa00002a50) at vm_insnhelper.c:2514
#15 vm_call_cfunc (ec=0x2aa00002a50, reg_cfp=0x3fffd9feae0, calling=<optimized out>, cd=0x2aa0008e678)
at vm_insnhelper.c:2539
#16 0x000003fffdd79578 in vm_call_method (ec=0x2aa00002a50, cfp=0x3fffd9feae0, calling=0x3ffffffb8e8, cd=0x2aa00583aa0)
at vm_insnhelper.c:3026
#17 0x000003fffdd5e452 in vm_sendish (ec=0x2aa00002a50,
ec@entry=<error reading variable: value has been optimized out>, reg_cfp=reg_cfp@entry=0x3fffd9feae0,
cd=cd@entry=0x2aa00583aa0, block_handler=<optimized out>,
method_explorer=method_explorer@entry=0x3fffdd66568 <vm_search_method_wrap>) at vm_insnhelper.c:4023
#18 0x000003fffdd701c8 in vm_exec_core (ec=<optimized out>, ec@entry=0x0, initial=initial@entry=0) at insns.def:782
#19 0x000003fffdd71fc8 in rb_vm_exec (ec=ec@entry=0x2aa00002a50, mjit_enable_p=mjit_enable_p@entry=1) at vm.c:1929
#20 0x000003fffdd72810 in invoke_block (ec=ec@entry=0x2aa00002a50, iseq=iseq@entry=0x2aa00586180,
self=self@entry=2929173767640, cref=cref@entry=0x0, type=572653569, opt_pc=0, captured=<optimized out>)
at vm.c:1044
#21 0x000003fffdd729a8 in invoke_iseq_block_from_c (me=0x0, is_lambda=<optimized out>, cref=0x0,
passed_block_handler=4398011476064, kw_splat=-15680, argv=0x3ffffffbe78, argc=1, self=2929173767640,
captured=0x3fffd9febd8, ec=0x2aa00002a50) at vm.c:1116
#22 invoke_block_from_c_bh (ec=ec@entry=0x2aa00002a50, block_handler=<optimized out>, argc=argc@entry=1,
argv=argv@entry=0x3ffffffbe78, kw_splat=kw_splat@entry=0, passed_block_handler=0, cref=0x0,
is_lambda=<optimized out>, force_blockarg=0) at vm.c:1134
#23 0x000003fffdd73152 in vm_yield (kw_splat=0, argv=0x3ffffffbe78, argc=1, ec=0x2aa00002a50) at vm.c:1179
#24 rb_yield_0 (argc=argc@entry=1, argv=argv@entry=0x3ffffffbe78) at vm_eval.c:1227
#25 0x000003fffdd73184 in rb_yield_1 (val=<optimized out>) at vm_eval.c:1233
#26 0x000003fffdd731bc in rb_yield (val=<optimized out>) at vm_eval.c:1243
#27 0x000003fffdbbe7aa in rb_ary_collect (ary=2929173762560) at array.c:3065
#28 0x000003fffdd6376a in vm_call_cfunc_with_frame (empty_kw_splat=<optimized out>, cd=0x2aa0008e678,
calling=<optimized out>, reg_cfp=0x3fffd9febc0, ec=0x2aa00002a50) at vm_insnhelper.c:2514
#29 vm_call_cfunc (ec=0x2aa00002a50, reg_cfp=0x3fffd9febc0, calling=<optimized out>, cd=0x2aa0008e678)
at vm_insnhelper.c:2539
#30 0x000003fffdd79578 in vm_call_method (ec=0x2aa00002a50, cfp=0x3fffd9febc0, calling=0x3ffffffc1a8, cd=0x2aa00596980)
at vm_insnhelper.c:3026
#31 0x000003fffdd5e452 in vm_sendish (ec=0x2aa00002a50,
ec@entry=<error reading variable: value has been optimized out>, reg_cfp=reg_cfp@entry=0x3fffd9febc0,
cd=cd@entry=0x2aa00596980, block_handler=<optimized out>,
method_explorer=method_explorer@entry=0x3fffdd66568 <vm_search_method_wrap>) at vm_insnhelper.c:4023
#32 0x000003fffdd701c8 in vm_exec_core (ec=<optimized out>, ec@entry=0x0, initial=initial@entry=0) at insns.def:782
#33 0x000003fffdd71fc8 in rb_vm_exec (ec=ec@entry=0x2aa00002a50, mjit_enable_p=mjit_enable_p@entry=1) at vm.c:1929
#34 0x000003fffdd72810 in invoke_block (ec=ec@entry=0x2aa00002a50, iseq=iseq@entry=0x2aa00585460,
self=self@entry=2929173439960, cref=cref@entry=0x0, type=572653569, opt_pc=0, captured=<optimized out>)
at vm.c:1044
#35 0x000003fffdd729a8 in invoke_iseq_block_from_c (me=0x0, is_lambda=<optimized out>, cref=0x0,
passed_block_handler=4398008493928, kw_splat=-13696, argv=0x3ffffffc738, argc=1, self=2929173439960,
captured=0x3fffd9fec80, ec=0x2aa00002a50) at vm.c:1116
#36 invoke_block_from_c_bh (ec=ec@entry=0x2aa00002a50, block_handler=<optimized out>, argc=argc@entry=1,
argv=argv@entry=0x3ffffffc738, kw_splat=kw_splat@entry=0, passed_block_handler=0, cref=0x0,
is_lambda=<optimized out>, force_blockarg=0) at vm.c:1134
#37 0x000003fffdd73152 in vm_yield (kw_splat=0, argv=0x3ffffffc738, argc=1, ec=0x2aa00002a50) at vm.c:1179
#38 rb_yield_0 (argc=argc@entry=1, argv=argv@entry=0x3ffffffc738) at vm_eval.c:1227
#39 0x000003fffdd73184 in rb_yield_1 (val=<optimized out>) at vm_eval.c:1233
#40 0x000003fffdd731bc in rb_yield (val=<optimized out>) at vm_eval.c:1243
#41 0x000003fffdbbb6a0 in rb_ary_each (ary=2929173764040) at array.c:2135
#42 0x000003fffdd6376a in vm_call_cfunc_with_frame (empty_kw_splat=<optimized out>, cd=0x3fffddc49c8,
calling=<optimized out>, reg_cfp=0x3fffd9fec68, ec=0x2aa00002a50) at vm_insnhelper.c:2514
#43 vm_call_cfunc (ec=0x2aa00002a50, reg_cfp=0x3fffd9fec68, calling=<optimized out>, cd=0x3fffddc49c8)
at vm_insnhelper.c:2539
#44 0x000003fffdd5e452 in vm_sendish (ec=0x2aa00002a50,
ec@entry=<error reading variable: value has been optimized out>, reg_cfp=reg_cfp@entry=0x3fffd9fec68,
cd=cd@entry=0x2aa005a0270, block_handler=<optimized out>,
method_explorer=method_explorer@entry=0x3fffdd66568 <vm_search_method_wrap>) at vm_insnhelper.c:4023
#45 0x000003fffdd701c8 in vm_exec_core (ec=<optimized out>, ec@entry=0x0, initial=initial@entry=0) at insns.def:782
#46 0x000003fffdd71fc8 in rb_vm_exec (ec=ec@entry=0x2aa00002a50, mjit_enable_p=mjit_enable_p@entry=1) at vm.c:1929
#47 0x000003fffdd72810 in invoke_block (ec=ec@entry=0x2aa00002a50, iseq=iseq@entry=0x2aa005854b0,
self=self@entry=2929173439960, cref=cref@entry=0x0, type=572653569, opt_pc=0, captured=<optimized out>)
at vm.c:1044
#48 0x000003fffdd729a8 in invoke_iseq_block_from_c (me=0x0, is_lambda=<optimized out>, cref=0x0,
passed_block_handler=4393751543814, kw_splat=-11712, argv=0x3ffffffcef8, argc=1, self=2929173439960,
captured=0x3fffd9fed28, ec=0x2aa00002a50) at vm.c:1116
#49 invoke_block_from_c_bh (ec=ec@entry=0x2aa00002a50, block_handler=<optimized out>, argc=argc@entry=1,
argv=argv@entry=0x3ffffffcef8, kw_splat=kw_splat@entry=0, passed_block_handler=0, cref=0x0,
is_lambda=<optimized out>, force_blockarg=0) at vm.c:1134
#50 0x000003fffdd73152 in vm_yield (kw_splat=0, argv=0x3ffffffcef8, argc=1, ec=0x2aa00002a50) at vm.c:1179
#51 rb_yield_0 (argc=argc@entry=1, argv=argv@entry=0x3ffffffcef8) at vm_eval.c:1227
#52 0x000003fffdd73184 in rb_yield_1 (val=<optimized out>) at vm_eval.c:1233
#53 0x000003fffdd731bc in rb_yield (val=<optimized out>) at vm_eval.c:1243
#54 0x000003fffdbbb6a0 in rb_ary_each (ary=2929173439920) at array.c:2135
#55 0x000003fffdd6376a in vm_call_cfunc_with_frame (empty_kw_splat=<optimized out>, cd=0x72720f9fffc06371,
calling=<optimized out>, reg_cfp=0x3fffd9fecd8, ec=0x2aa00002a50) at vm_insnhelper.c:2514
#56 vm_call_cfunc (ec=0x2aa00002a50, reg_cfp=0x3fffd9fecd8, calling=<optimized out>, cd=0x72720f9fffc06371)
at vm_insnhelper.c:2539
#57 0x000003fffdd5e452 in vm_sendish (ec=0x2aa00002a50,
ec@entry=<error reading variable: value has been optimized out>, reg_cfp=reg_cfp@entry=0x3fffd9fecd8,
cd=cd@entry=0x2aa0058b2c0, block_handler=<optimized out>,
method_explorer=method_explorer@entry=0x3fffdd66568 <vm_search_method_wrap>) at vm_insnhelper.c:4023
#58 0x000003fffdd701c8 in vm_exec_core (ec=<optimized out>, ec@entry=0x0, initial=initial@entry=0) at insns.def:782
#59 0x000003fffdd71fc8 in rb_vm_exec (ec=ec@entry=0x2aa00002a50, mjit_enable_p=mjit_enable_p@entry=1) at vm.c:1929
#60 0x000003fffdd72810 in invoke_block (ec=ec@entry=0x2aa00002a50, iseq=iseq@entry=0x2aa003d72f8,
self=self@entry=2929171614160, cref=cref@entry=0x2aa003d5278, type=572653569, opt_pc=0, captured=<optimized out>)
at vm.c:1044
#61 0x000003fffdd729a8 in invoke_iseq_block_from_c (me=0x0, is_lambda=<optimized out>, cref=0x2aa003d5278,
passed_block_handler=2929171614160, kw_splat=5743888, argv=0x3ffffffd6f8, argc=1, self=2929171614160,
captured=0x3ffffffd630, ec=0x2aa00002a50) at vm.c:1116
#62 invoke_block_from_c_bh (ec=ec@entry=0x2aa00002a50, block_handler=<optimized out>, argc=<optimized out>,
argv=0x3ffffffd6f8, kw_splat=kw_splat@entry=0, passed_block_handler=0, cref=0x2aa003d5278,
is_lambda=<optimized out>, force_blockarg=0) at vm.c:1134
#63 0x000003fffdd72f2c in vm_yield_with_cref (is_lambda=<optimized out>, cref=0x2aa003d5278, kw_splat=<optimized out>,
argv=<optimized out>, argc=<optimized out>, ec=0x2aa00002a50) at vm.c:1171
#64 yield_under (under=under@entry=2929173439760, self=2929171614160, argc=<optimized out>, argc@entry=1,
argv=<optimized out>, argv@entry=0x3ffffffd6f8, kw_splat=<optimized out>, kw_splat@entry=3) at vm_eval.c:1879
#65 0x000003fffdd7a0a4 in specific_eval (argc=argc@entry=0, argv=argv@entry=0x3fffd8ff1c0, klass=2929173439760,
self=<optimized out>, self@entry=2929171614160, kw_splat=kw_splat@entry=3) at vm_eval.c:1920
#66 0x000003fffdd7a2a0 in rb_obj_instance_eval_internal (argc=<optimized out>, argv=0x3fffd8ff1c0, self=2929171614160)
at vm_eval.c:1993
#67 0x000003fffdd6376a in vm_call_cfunc_with_frame (empty_kw_splat=<optimized out>, cd=0x0, calling=<optimized out>,
reg_cfp=0x3fffd9fedf0, ec=0x2aa00002a50) at vm_insnhelper.c:2514
#68 vm_call_cfunc (ec=0x2aa00002a50, reg_cfp=0x3fffd9fedf0, calling=<optimized out>, cd=0x0) at vm_insnhelper.c:2539
#69 0x000003fffdd5e452 in vm_sendish (ec=0x2aa00002a50,
ec@entry=<error reading variable: value has been optimized out>, reg_cfp=reg_cfp@entry=0x3fffd9fedf0,
cd=cd@entry=0x2aa00480360, block_handler=<optimized out>,
method_explorer=method_explorer@entry=0x3fffdd66568 <vm_search_method_wrap>) at vm_insnhelper.c:4023
#70 0x000003fffdd701c8 in vm_exec_core (ec=<optimized out>, ec@entry=0x0, initial=initial@entry=0) at insns.def:782
#71 0x000003fffdd71fc8 in rb_vm_exec (ec=ec@entry=0x2aa00002a50, mjit_enable_p=mjit_enable_p@entry=1) at vm.c:1929
#72 0x000003fffdd72810 in invoke_block (ec=ec@entry=0x2aa00002a50, iseq=iseq@entry=0x2aa003e9f70,
self=self@entry=2929172774640, cref=cref@entry=0x0, type=572653569, opt_pc=0, captured=<optimized out>)
at vm.c:1044
#73 0x000003fffdd729a8 in invoke_iseq_block_from_c (me=0x0, is_lambda=<optimized out>, cref=0x0,
passed_block_handler=4398011476064, kw_splat=224568, argv=0x3ffffffded8, argc=2, self=2929172774640,
captured=0x3fffd9fee78, ec=0x2aa00002a50) at vm.c:1116
#74 invoke_block_from_c_bh (ec=ec@entry=0x2aa00002a50, block_handler=<optimized out>, argc=argc@entry=2,
argv=argv@entry=0x3ffffffded8, kw_splat=kw_splat@entry=0, passed_block_handler=0, cref=0x0,
is_lambda=<optimized out>, force_blockarg=0) at vm.c:1134
#75 0x000003fffdd73152 in vm_yield (kw_splat=0, argv=0x3ffffffded8, argc=2, ec=0x2aa00002a50) at vm.c:1179
#76 rb_yield_0 (argc=<optimized out>, argv=argv@entry=0x3ffffffded8) at vm_eval.c:1227
#77 0x000003fffdd732c2 in rb_yield_values2 (argc=argc@entry=2, argv=argv@entry=0x3ffffffded8) at vm_eval.c:1273
#78 0x000003fffdc4175e in each_pair_i_fast (key=<optimized out>, value=<optimized out>, _=<optimized out>)
at hash.c:3057
#79 0x000003fffdc42eb2 in hash_ar_foreach_iter (error=0, argp=4398046503384, value=<optimized out>,
key=<optimized out>) at hash.c:1337
#80 ar_foreach_check (func=<optimized out>, never=52, arg=4398046503384, hash=2929171613960) at hash.c:962
#81 hash_foreach_call (arg=4398046503384) at hash.c:1485
#82 0x000003fffdc252dc in rb_ensure (b_proc=0x3fffdc2531e <rb_ensure+342>,
b_proc@entry=0x3fffdc42de8 <hash_foreach_call>, data1=4398046503160, data1@entry=4398046503384,
e_proc=e_proc@entry=0x3fffdc41008 <hash_foreach_ensure>, data2=data2@entry=2929171613960) at eval.c:1129
#83 0x000003fffdc44be2 in rb_hash_foreach (farg=0, func=0x3fffdc41720 <each_pair_i_fast>, hash=2929171613960)
at hash.c:1509
#84 rb_hash_foreach (hash=2929171613960, func=0x3fffdc41720 <each_pair_i_fast>, farg=0) at hash.c:1499
#85 0x000003fffdc455e2 in rb_hash_each_pair (hash=<optimized out>) at hash.c:3088
#86 rb_hash_each_pair (hash=2929171613960) at hash.c:3084
#87 0x000003fffdd6376a in vm_call_cfunc_with_frame (empty_kw_splat=<optimized out>, cd=0x3fffdfa4828,
calling=<optimized out>, reg_cfp=0x3fffd9fee60, ec=0x2aa00002a50) at vm_insnhelper.c:2514
#88 vm_call_cfunc (ec=0x2aa00002a50, reg_cfp=0x3fffd9fee60, calling=<optimized out>, cd=0x3fffdfa4828)
at vm_insnhelper.c:2539
#89 0x000003fffdd5e452 in vm_sendish (ec=0x2aa00002a50,
ec@entry=<error reading variable: value has been optimized out>, reg_cfp=reg_cfp@entry=0x3fffd9fee60,
cd=cd@entry=0x2aa00477d80, block_handler=<optimized out>,
method_explorer=method_explorer@entry=0x3fffdd66568 <vm_search_method_wrap>) at vm_insnhelper.c:4023
#90 0x000003fffdd701c8 in vm_exec_core (ec=<optimized out>, ec@entry=0x0, initial=initial@entry=0) at insns.def:782
#91 0x000003fffdd71fc8 in rb_vm_exec (ec=<optimized out>, mjit_enable_p=mjit_enable_p@entry=1) at vm.c:1929
#92 0x000003fffdd7a5fa in rb_iseq_eval (iseq=iseq@entry=0x2aa003d7348) at vm.c:2168
#93 0x000003fffdc6907a in load_iseq_eval (ec=0x2aa00002a50, fname=2929171806840) at load.c:585
#94 0x000003fffdc692d0 in rb_load_internal (fname=<optimized out>, wrap=<optimized out>) at load.c:643
#95 0x000003fffdc69fce in rb_f_load (argc=<optimized out>, argv=<optimized out>, _=<optimized out>) at load.c:701
#96 0x000003fffdd6376a in vm_call_cfunc_with_frame (empty_kw_splat=<optimized out>, cd=0x2aa000bce88,
calling=<optimized out>, reg_cfp=0x3fffd9fef08, ec=0x2aa00002a50) at vm_insnhelper.c:2514
#97 vm_call_cfunc (ec=0x2aa00002a50, reg_cfp=0x3fffd9fef08, calling=<optimized out>, cd=0x2aa000bce88)
at vm_insnhelper.c:2539
#98 0x000003fffdd79578 in vm_call_method (ec=0x2aa00002a50, cfp=0x3fffd9fef08, calling=0x3ffffffec10, cd=0x2aa004c67f0)
at vm_insnhelper.c:3026
#99 0x000003fffdd5e452 in vm_sendish (ec=0x2aa00002a50,
ec@entry=<error reading variable: value has been optimized out>, reg_cfp=reg_cfp@entry=0x3fffd9fef08,
cd=0x2aa004c67f0, block_handler=block_handler@entry=0,
method_explorer=method_explorer@entry=0x3fffdd66568 <vm_search_method_wrap>) at vm_insnhelper.c:4023
#100 0x000003fffdd6e0a2 in vm_exec_core (ec=<optimized out>, ec@entry=0x0, initial=initial@entry=0) at insns.def:801
#101 0x000003fffdd71fc8 in rb_vm_exec (ec=<optimized out>, mjit_enable_p=mjit_enable_p@entry=1) at vm.c:1929
#102 0x000003fffdd7a5fa in rb_iseq_eval (iseq=iseq@entry=0x2aa0006f228) at vm.c:2168
#103 0x000003fffdc6907a in load_iseq_eval (ec=0x2aa00002a50, fname=2929169827160) at load.c:585
#104 0x000003fffdc692d0 in rb_load_internal (fname=<optimized out>, wrap=<optimized out>) at load.c:643
#105 0x000003fffdc69fce in rb_f_load (argc=<optimized out>, argv=<optimized out>, _=<optimized out>) at load.c:701
#106 0x000003fffdd6376a in vm_call_cfunc_with_frame (empty_kw_splat=<optimized out>, cd=0x2aa000bce88,
calling=<optimized out>, reg_cfp=0x3fffd9fef78, ec=0x2aa00002a50) at vm_insnhelper.c:2514
#107 vm_call_cfunc (ec=0x2aa00002a50, reg_cfp=0x3fffd9fef78, calling=<optimized out>, cd=0x2aa000bce88)
at vm_insnhelper.c:2539
#108 0x000003fffdd79578 in vm_call_method (ec=0x2aa00002a50, cfp=0x3fffd9fef78, calling=0x3fffffff400,
cd=0x2aa0045d590) at vm_insnhelper.c:3026
#109 0x000003fffdd5e452 in vm_sendish (ec=0x2aa00002a50,
ec@entry=<error reading variable: value has been optimized out>, reg_cfp=reg_cfp@entry=0x3fffd9fef78,
cd=0x2aa0045d590, block_handler=block_handler@entry=0,
method_explorer=method_explorer@entry=0x3fffdd66568 <vm_search_method_wrap>) at vm_insnhelper.c:4023
#110 0x000003fffdd6e0a2 in vm_exec_core (ec=<optimized out>, ec@entry=0x0, initial=initial@entry=0) at insns.def:801
#111 0x000003fffdd71fc8 in rb_vm_exec (ec=<optimized out>, mjit_enable_p=mjit_enable_p@entry=1) at vm.c:1929
#112 0x000003fffdd7a6d2 in rb_iseq_eval_main (iseq=iseq@entry=0x0) at vm.c:2179
#113 0x000003fffdc22672 in rb_ec_exec_node (ec=ec@entry=0x2aa00002a50, n=n@entry=0x2aa0007d418) at eval.c:278
#114 0x000003fffdc26f5c in ruby_run_node (n=0x2aa0007d418) at eval.c:336
#115 0x000002aa00000994 in main (argc=<optimized out>, argv=<optimized out>) at ./main.c:50
</code></pre>
<p>This ruby build was built with <a href="https://github.com/kaniini/libucontext/" class="external">libucontext</a>, and ruby's testsuite passed (which it didn't with --with-coroutines=copy. see <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: Fiber crashes with --with-coroutine=copy (Closed)" href="https://bugs.ruby-lang.org/issues/16809">#16809</a>)</p> Ruby master - Bug #16158 (Open): "st" Character Sequence In Regex Look-Behind Causes Illegal Patt...https://bugs.ruby-lang.org/issues/161582019-09-09T15:14:59Zmichaeltomko (Michael Tomko)
<p><em>This is my first Ruby bug submission. Please let me know if there is anything else that I can provide that would be helpful. Thanks for your time!</em></p>
<p>I've tried just about as many combinations as I can think of and I have been able to narrow down the issue to the following components being present in a regular expression.</p>
<ul>
<li>The character sequence "st" either preceded by any characters OR being a part of a top-level alternation inside of a look-behind. The issue occurs with both positive and negative look-behinds. ex: <code>(?<!Costa)</code> or <code>(?<!Bob|Sally|Stan)</code> or <code>(?<= st)</code>
</li>
<li>Case insensitivity either being set globally or inside of the regex with <code>(?i)</code> preceding the look-behind.</li>
<li>Any curly-style POSIX bracket expression included anywhere in the regex. ex: <code>\p{Space}</code> or <code>\p{L}</code>
</li>
</ul>
<p>Here are some examples of the error. I have tested this on 2.5.0 locally and [on 2.5.3 with Rubular] (<a href="https://rubular.com/r/jnr98E9JfAZJIQ" class="external">https://rubular.com/r/jnr98E9JfAZJIQ</a>).</p>
<pre><code>2.5.0 :044 > pat = /(?<!a st)\p{Space}/i
Traceback (most recent call last):
SyntaxError ((irb):44: invalid pattern in look-behind: /(?<!a st)\p{Space}/i)
2.5.0 :047 > pat = /(?i)(?<!a st)\p{Space}/
Traceback (most recent call last):
SyntaxError ((irb):47: invalid pattern in look-behind: /(?i)(?<!a st)\p{Space}/)
2.5.0 :016 > pat = /(?<!Costa)Mesa(\p{Space}|\p{Punct})+(AZ|Arizona)/i
Traceback (most recent call last):
SyntaxError ((irb):16: invalid pattern in look-behind: /(?<=Costa)Mesa(\p{Space}|\p{Punct})+(AZ|Arizona)/i)
</code></pre>
<p>My expectation would be that this regular expression would compile as written, as it does in JRuby and in MacOS regex testing apps like Patterns or Reggy.</p>
<p>It does compile as expected if the case insensitivity flag is removed or instantiated after the look-behind, if the "st" character sequence is first in the look-behind and not apart of an alternation, or if different types of operators are substituted for the POSIX bracket expressions.</p>
<pre><code>2.5.0 :007 > pat = /((?<!Cosa)Mesa|Arlington(?=([:space:]|[:punct:])+(AZ|Arizona)))/
=> /((?<!Cosa)Mesa|Arlington(?=(\p{Space}|\p{Punct})+(AZ|Arizona)))/
2.5.0 :008 > pat = /((?<!Cosa)Mesa|Arlington(?=([:space:]|[:punct:])+(AZ|Arizona)))/i
=> /((?<!Cosa)Mesa|Arlington(?=([:space:]|[:punct:])+(AZ|Arizona)))/i
2.5.0 :009 > pat = /((?<!Cosa)Mesa|Arlington(?=([:space:]|[:punct:])+(AZ|Arizona)))/i
=> /((?<!Cosa)Mesa|Arlington(?=(\s|\W)+(AZ|Arizona)))/i
2.5.0 :056 > pat = /(?<!a st)(?i)(?<!juice)\p{Space}/
=> /(?<!a st)(?i)(?<!juice)\p{Space}/
2.5.0 :058 > pat = /(?<!a st)(?i)(?<!stark)\p{Space}/
=> /(?<!a st)(?i)(?<!stark)\p{Space}/
</code></pre> Ruby master - Bug #16145 (Open): regexp match error if mixing /i, character classes, and utf8https://bugs.ruby-lang.org/issues/161452019-09-05T19:40:03Zzenspider (Ryan Davis)
<p>(reported on behalf of <a href="mailto:mage@mage.gold" class="email">mage@mage.gold</a> -- there appears to be an error in registration or login):</p>
<p>See: ruby-talk @ X-Mail-Count: 440336</p>
<p>2.6.3 :049 > 'SHOP' =~ /[xo]/i<br>
=> 2<br>
2.6.3 :050 > 'CAFÉ' =~ /[é]/i<br>
=> 3<br>
2.6.3 :051 > 'CAFÉ' =~ /[xé]/i<br>
=> nil<br>
2.6.3 :052 > 'CAFÉ' =~ /[xÉ]/i<br>
=> 3</p>
<p>Expected result:<br>
2.6.3 :051 > 'CAFÉ' =~ /[xé]/i<br>
=> 3</p>
<p>I tested it on random regex online pages.</p>
<p>It does not match on <a href="https://regex101.com/" class="external">https://regex101.com/</a></p>
<p>It matches on:</p>
<p><a href="https://regexr.com/" class="external">https://regexr.com/</a><br>
<a href="https://www.regextester.com/" class="external">https://www.regextester.com/</a><br>
<a href="https://www.freeformatter.com/regex-tester.html" class="external">https://www.freeformatter.com/regex-tester.html</a></p>
<p>(Ignore case turned on).</p>
<p>The reason I suppose it’s more like a bug than a feature is the fact that /[é]/i matches 'CAFÉ'. If the //i didn’t work for UTF-8 characters then the /[é]/i wouldn’t match it either. For example, [é] does not match 'CAFÉ' on <a href="https://regex101.com/" class="external">https://regex101.com/</a></p>
<p>I could not find a page or a system that behaves the same way as Ruby does. For example, it matches in PostgreSQL 10 (under FreeBSD 12) too:</p>
<a name="select-CAFÉ-xé"></a>
<h1 >select 'CAFÉ'~ '[xé]';<a href="#select-CAFÉ-xé" class="wiki-anchor">¶</a></h1>
<a name="column"></a>
<h2 >?column?<a href="#column" class="wiki-anchor">¶</a></h2>
<p>f<br>
(1 row)</p>
<a name="select-CAFÉ-xé-2"></a>
<h1 >select 'CAFÉ' ~* '[xé]';<a href="#select-CAFÉ-xé-2" class="wiki-anchor">¶</a></h1>
<a name="column-2"></a>
<h2 >?column?<a href="#column-2" class="wiki-anchor">¶</a></h2>
<p>t<br>
(1 row)</p>
<p>Tested it in IRB on macOS and FreeBSD.</p>
<p>$ uname -a && ruby -v && locale<br>
Darwin xxx 18.7.0 Darwin Kernel Version 18.7.0: Thu Jun 20 18:42:21 PDT 2019; root:xnu-4903.270.47~4/RELEASE_X86_64 x86_64<br>
ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-darwin18]<br>
LANG="en_US.UTF-8"<br>
LC_COLLATE="en_US.UTF-8"<br>
LC_CTYPE="en_US.UTF-8"<br>
LC_MESSAGES="en_US.UTF-8"<br>
LC_MONETARY="en_US.UTF-8"<br>
LC_NUMERIC="en_US.UTF-8"<br>
LC_TIME="en_US.UTF-8"<br>
LC_ALL="en_US.UTF-8"</p>
<p>$ uname -a && ruby -v && locale<br>
FreeBSD xxx 12.0-RELEASE-p9 FreeBSD 12.0-RELEASE-p9 GENERIC amd64<br>
ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-freebsd12.0]<br>
LANG=en_US.UTF-8<br>
LC_CTYPE="en_US.UTF-8"<br>
LC_COLLATE="en_US.UTF-8"<br>
LC_TIME="en_US.UTF-8"<br>
LC_NUMERIC="en_US.UTF-8"<br>
LC_MONETARY="en_US.UTF-8"<br>
LC_MESSAGES="en_US.UTF-8"<br>
LC_ALL=en_US.UTF-8</p>
<p>I installed Ruby with RVM.</p> Ruby master - Bug #15993 (Open): 'require' doesn't work if there are Cyrillic chars in the path t...https://bugs.ruby-lang.org/issues/159932019-07-10T19:41:05Zinversion (Yura Babak)
<p>I’m trying to build a cross-platform portable application with Ruby onboard and there is a problem on Windows.<br>
A user usually installs it to the Roaming folder which sits inside a user folder which can often have not a Latin name or contain spaces).<br>
When there is a Cyrillic character (maybe just not Latin) in the path — require of any gem doesn’t work:</p>
<pre><code>D:\users\киї\Ruby\2.6\bin>ruby -v
ruby 2.6.3p62 (2019-04-16 revision 67580) [x64-mingw32]
D:\users\киї\Ruby\2.6\bin>ruby -e "require 'logger'"
Traceback (most recent call last):
1: from <internal:gem_prelude>:2:in `<internal:gem_prelude>'
<internal:gem_prelude>:2:in `require': No such file or directory -- D:/users/РєРёС—/Ruby/2.6/lib/ruby/2.6.0/rubygems.rb (LoadError)
D:\users\киї\Ruby\2.6\bin>ruby --disable=rubyopt -e "require 'logger'"
Traceback (most recent call last):
1: from <internal:gem_prelude>:2:in `<internal:gem_prelude>'
<internal:gem_prelude>:2:in `require': No such file or directory -- D:/users/РєРёС—/Ruby/2.6/lib/ruby/2.6.0/rubygems.rb (LoadError)
D:\users\киї\Ruby\2.6\bin>gem list
Traceback (most recent call last):
1: from <internal:gem_prelude>:2:in `<internal:gem_prelude>'
<internal:gem_prelude>:2:in `require': No such file or directory -- D:/users/РєРёС—/Ruby/2.6/lib/ruby/2.6.0/rubygems.rb (LoadError)
</code></pre>
<p>We can see such encoding transformations in the output:</p>
<pre><code>киї (utf-8) == РєРёС— (win1251)
</code></pre>
<p>I have an old Ruby installation that works fine:</p>
<pre><code>D:\users\киї\Ruby\2.0\bin>ruby -e "require 'logger'"
D:\users\киї\Ruby\2.0\bin>ruby -v
ruby 2.0.0p451 (2014-02-24) [i386-mingw32]
</code></pre>
<p>The same is for <code>ruby 2.0.0p643 (2015-02-25) [i386-mingw32]</code> .</p>
<p>I also checked that require fails in the same case for<br>
<code>ruby 2.1.9p490 (2016-03-30 revision 54437) [i386-mingw32]</code></p> Ruby master - Bug #15764 (Open): Whitespace and control characters should not be permitted in tokenshttps://bugs.ruby-lang.org/issues/157642019-04-11T20:59:47ZBatmanAoD (Kyle Strand)kyle.j.strand@gmail.com
<p>As of Ruby 2.5.1p57, it appears that all valid Unicode code-points above 128 are permitted in tokens. This includes whitespace and control characters.</p>
<p>This was demonstrated here: <a href="https://gist.github.com/qrohlf/7045823" class="external">https://gist.github.com/qrohlf/7045823</a></p>
<p>I have attached the raw download from the above gist.</p>
<p>The issue has been discussed on StackOverflow: <a href="https://stackoverflow.com/q/34455427/1858225" class="external">https://stackoverflow.com/q/34455427/1858225</a></p>
<p>I would say this is arguably a bug, but I am marking this ticket as a "feature" since the current behavior could be considered by-design.</p> Ruby master - Bug #15386 (Open): [PATCH] io.c (rb_io_check_char_readable): do not io_fflush buffe...https://bugs.ruby-lang.org/issues/153862018-12-06T11:38:00Znormalperson (Eric Wong)normalperson@yhbt.net
<pre><code>This is a rare corner-case probably nobody cares about. (because
socket has IO#sync=false by default). Not critical to fix
or change before 2.6 (I'm not sure if there's a compatibility risk).
Would much appreciate an extra set of eyes to review; but it can wait
for post-26.
[I tried taking a break from C and ruby-core to work on a different
project today; but hit this bug within an hour of doing that :<]
io.c (rb_io_check_char_readable): do not io_fflush buffered sockets
I enabled userspace buffering on sockets to reduce syscall
overhead while avoiding non-portable TCP_CORK/TCP_NOPUSH.
This deadlocked for me because I was using independent threads
for reading and writing simultaneously on the same socket.
I also experimented with making io_fflush optionally
non-blocking, but that caused stream corruption with the reader
thread doing some writes.
https://80x24.org/spew/20181206104008.29153-1-e@80x24.org/raw
Test script (hitting
news://news.public-inbox.org/inbox.comp.version-control.git
is fine)
require 'socket'
require 'uri'
require 'io/nonblock'
usage = "usage: #$0 news://news.public-inbox.org/inbox.comp.version-control.git"
uri = ARGV.shift or abort usage
uri = URI(uri)
uri.port ||= 119
group = uri.path.sub(%r{\A/+}, '') # String#delete_prefix requires Ruby 2.5+
s = Socket.tcp(uri.host, uri.port)
l = s.gets
l =~ /\A2\d\d / or abort "bad greeting: #{l}"
s.nonblock = true
s.puts "GROUP #{group}"
l = s.gets
code, _, min, max = l.chomp!.split.map!(&:to_i)
code == 211 or abort "bad GROUP response: #{l}"
rdr = Thread.new do
nres = 0
r = s.dup
while l = r.gets
l.start_with?('205 ') and break # cmd_quit
l.start_with?('224 ') or abort "bad OVER response: #{l}"
while l = r.gets
if l == ".\r\n"
nres += 1
break
end
end
end
nres
end
range = min..max
s.sync = false
range.each { |i| s.puts "XOVER #{i}" }
puts "requests=#{range.size} #{Time.now}"
s.puts "QUIT"
s.flush
puts "responses=#{rdr.value} #{Time.now}"
</code></pre> Ruby master - Bug #15310 (Open): [PATCH] thread_pthread.c: close race from UBF_TIMER and non-GVL-...https://bugs.ruby-lang.org/issues/153102018-11-16T02:30:10Znormalperson (Eric Wong)normalperson@yhbt.net
<p>thread_pthread.c: close race from UBF_TIMER and non-GVL-releasing thread</p>
<p>A Ruby thread may run without releasing the GVL if there is no<br>
contention. And there may be no contention because another<br>
thread missed its wakeup and needs to rely on ubf_list for<br>
wakeups. So we need to ensure the Ruby thread can relinquish<br>
GVL and trigger ubf_list wakeups to target thread when the POSIX<br>
timer fires.</p>
<p>Thus, we trigger a timeslice on SIGVTALRM when triggered by<br>
UBF_TIMER (we do not want excessive switching overhead on every<br>
SIGVTALRM signal, either).</p>
<p>Note: I'm pretty sure this is necessary, correct and would introduce no<br>
portability problems or performance overhead if I'm wrong...<br>
I could definitely use an extra set of eyes on this, though.</p> Ruby master - Bug #15263 (Open): [PATCH] vm_trace.c (postponed_job_register): only hit main threadhttps://bugs.ruby-lang.org/issues/152632018-10-27T23:35:33Znormalperson (Eric Wong)normalperson@yhbt.net
<pre><code>vm_trace.c (postponed_job_register): only hit main thread
Since postponed_job_register may be called in a signal handler,
only the main thread is safe to touch as other threads may
become invalid. Furthermore, the problem with trap interrupt
being lost during ec_switch [Bug #14939] also applies to the
postponed job and timer interrupts, so we need to preserve all
three interrupts in ec_switch.
Note: A minor problem is a possible crash during/after
ruby_vm_destruct if postponed jobs are registered.
The correct and performant fix would be to leak memory at exit
for `vm' and `vm->main_thread'. free(3) slows down short-lived
scripts, as does unregistering signal handlers.
* vm_trace.c (postponed_job_register): only hit main thread
* cont.c (ec_switch): preserve postponed and timer interrupt flags, too
</code></pre> Ruby master - Bug #15247 (Open): Windows - TEMP folder, non 8.3 & drive, fails & errors in test-a...https://bugs.ruby-lang.org/issues/152472018-10-23T17:02:28ZMSP-Greg (Greg L)
<p>While working with Azure pipelines, two issues came up related to the TEMP folder.</p>
<p>1. The standard Windows TEMP folder is located in a user directory. The user for pipeplines is 'buildguest', which is greater than 8 characters, and hence, its short and long paths differ. When I created a new user account locally on Windows 10, both ENV['TEMP'] and ENV['TMP'] were set to the short path.</p>
<p>This is causes two failures in <code>test/rdoc/test_rdoc_rdoc.rb</code> and one failure in <code>test_dir.rb</code>, the failures are listed in the attached file temp_short-long.txt.</p>
<p>2. Azure pipelines has the normal TEMP folder on drive C:, but, unlike Appveyor, the repo is placed on drive D:. This causes one failure in <code>test/rdoc/test_rdoc_options.rb</code>, and two errors from the same file, but in the std-Lib file <code>pathname.rb</code>. See attached file temp_drive.txt.</p>
<p>I'm not really sure what I think the solution for this is, as the issue is really due to Windows setting ENV['TEMP'] and ENV['TMP'] to short paths. I do recall the same issues happened on my old multi-drive desktop system. At the time, there were more significant issues with build/test, so I reconfigured the env for that...</p> Ruby master - Bug #14838 (Open): RegexpError with double "s" in look-behind assertion in case-ins...https://bugs.ruby-lang.org/issues/148382018-06-09T16:04:07Zjkamens@quantopian.com (Jonathan Kamens)jkamens@quantopian.com
<pre><code>irb(main):003:0> %r{(?<!bss>)}ui
Traceback (most recent call last):
1: from /usr/bin/irb:11:in `<main>'
SyntaxError ((irb):3: invalid pattern in look-behind: /(?<!bss>)/i)
</code></pre>
<p>The error goes away if you remove the "u" or "i" modifier. It comes back if you leave just the "i" modifier and then apply the regexp to a unicode string, since at that point the regexp gets converted to unicode.</p>
<p>See also the same bug in JRuby: <a href="https://github.com/jruby/jruby/issues/5086" class="external">https://github.com/jruby/jruby/issues/5086</a><br>
And their fix: <a href="https://github.com/jruby/jruby/commit/a72224d8a010f162d797e79cf73c21e78c0d59a0" class="external">https://github.com/jruby/jruby/commit/a72224d8a010f162d797e79cf73c21e78c0d59a0</a></p> Ruby master - Bug #14761 (Open): TestThread#test_join_limits hangs up on Solaris 10 with gcchttps://bugs.ruby-lang.org/issues/147612018-05-15T14:21:08Zngoto (Naohisa Goto)ngotogenome@gmail.com
<p>On Solaris 10, sparc architecture, when compiling ruby (r63417) by GCC (version 4.6.2), TestThread#test_join_limits did not end.</p>
<p>The test ended successfully when compiling ruby by Oracle Developer Studio 12.5 or 12.6.</p> Ruby master - Bug #14681 (Open): `syswrite': stream closed in another thread (IOError)https://bugs.ruby-lang.org/issues/146812018-04-12T03:16:08Zioquatix (Samuel Williams)samuel@oriontransfer.net
<p>Perhaps related to <a href="https://bugs.ruby-lang.org/issues/13632" class="external">https://bugs.ruby-lang.org/issues/13632</a></p>
<p>Here is a sample to reproduce the issue.</p>
<pre><code>#!/usr/bin/env ruby
require 'thread'
puts RUBY_VERSION
100.times.collect do
Thread.new do
input, output = IO.pipe
worker = Thread.new do
sleep(0.1)
output.syswrite('.')
end
input.read(1)
input.close
output.close
worker.join
end
end.each(&:join)
</code></pre>
<p>If you run this, you will get output like so:</p>
<pre><code>2.5.0
#<Thread:0x00007fb7a4956ee8@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:11 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a50bb468@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:11 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a4964250@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:11 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a49386f0@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:11 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a493ab08@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:11 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a495fb88@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:8 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a50bbb98@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:11 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a4948820@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:11 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a4939820@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:11 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a486a458@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:8 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a4860020@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:11 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a4970258@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:11 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a4973f48@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:11 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a4948618@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:11 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a495f728@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:8 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a495f868@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:8 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a4848628@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:8 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a4843858@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:8 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a4809400@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:8 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a5085278@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:8 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a495e0f8@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:8 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a48417d8@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:11 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a5037c80@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:8 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a4948398@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:11 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a4948c30@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:11 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a4939b18@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:11 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a4957500@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:11 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a480a9b8@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:8 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a5036d30@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:8 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a5085c50@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:8 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a495e2b0@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:8 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a495f070@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:8 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a495e6e8@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:8 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a49572d0@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:11 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a495e580@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:8 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a494a350@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:11 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a4811060@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:8 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a50842b0@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:8 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a494bb10@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:11 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a493ae00@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:11 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a495e878@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:8 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a494be30@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:11 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a4809c70@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:8 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a480a4e0@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:8 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a50b90f0@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:11 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
#<Thread:0x00007fb7a4965600@/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:8 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
Traceback (most recent call last):
1: from /private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `block (3 levels) in <main>'
/private/var/folders/3x/tvygzl0s65520b6t4tzqbt980000gn/T/16789369-c982-4cbc-a0b3-c836af60bf03:13:in `syswrite': stream closed in another thread (IOError)
Exited with status 1 after 0.291 seconds
</code></pre>
<p>However, you can clearly see from the order of the sample code it's not possible for such an error to occur. <code>#close</code> is only invoked after a successful <code>#read</code> which is only possible after a successful <code>#write</code>. Yet, the error implies that the write failed because it was already closed.</p> Ruby master - Bug #14640 (Open): [win32] File.realpath treats a relative path with a drive letter...https://bugs.ruby-lang.org/issues/146402018-03-28T16:18:34Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<p>When <code>t</code> exists in the current directory under the drive C:,</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="no">File</span><span class="p">.</span><span class="nf">realpath</span><span class="p">(</span><span class="s2">"c:t"</span><span class="p">)</span> <span class="c1">#=> No such file or directory @ realpath_rec - c:/t (Errno::ENOENT)</span>
</code></pre>
<p>whereas <code>File.expand_path</code> returns <code>Dir.pwd + "/t"</code>.</p> Ruby master - Bug #14582 (Open): Unable to use `method__entry` and `method_return` tracing probes...https://bugs.ruby-lang.org/issues/145822018-03-07T06:23:00Zguilhermereiscampos (Guilherme Reis Campos)guilhermekbsa@gmail.com
<p>Hi,</p>
<p>I am trying to use dtrace/systemtap probes and not being able to use it after the 2.5. The 2.4 version works fine. I was hoping this was fixed on 2.6-preview, but apparently not (just downloaded dev and tested).</p>
<p>I tried on OSX using dtrace and also on ubuntu (vagrant).</p>
<pre><code># test.rb
class Foo
def bar
100.times { "Bar" }
end
end
foo = Foo.new
foo.bar
# test.stp
probe process("/home/vagrant/.rbenv/versions/2.4.0/bin/ruby").mark("method__entry") # you will need to change this to your ruby path of your version.
{
printf("%s => %s.%s in %s:%d\n", thread_indent(1), kernel_string($arg1),kernel_string($arg2),kernel_string($arg3),$arg4);
}
probe process("/home/vagrant/.rbenv/versions/2.4.0/bin/ruby").mark("method__return")
{
printf("%s <= %s.%s in %s:%d\n", thread_indent(-1), kernel_string($arg1),kernel_string($arg2),kernel_string($arg3),$arg4);
}
</code></pre>
<p>dtrace was something similar to it.</p>
<p>I was expecting to see this output:</p>
<pre><code># lots of calls
# ....
# then:
4090 ruby(9667): <= Gem::Specification.unresolved_deps in /home/vagrant/.rbenv/versions/2.4.0/lib/ruby/2.4.0/rubygems/specification.rb:1298
4095 ruby(9667): => MonitorMixin.mon_exit in /home/vagrant/.rbenv/versions/2.4.0/lib/ruby/2.4.0/monitor.rb:197
4100 ruby(9667): => MonitorMixin.mon_check_owner in /home/vagrant/.rbenv/versions/2.4.0/lib/ruby/2.4.0/monitor.rb:247
4104 ruby(9667): <= MonitorMixin.mon_check_owner in /home/vagrant/.rbenv/versions/2.4.0/lib/ruby/2.4.0/monitor.rb:251
4109 ruby(9667): <= MonitorMixin.mon_exit in /home/vagrant/.rbenv/versions/2.4.0/lib/ruby/2.4.0/monitor.rb:204
4283 ruby(9667): <= Kernel.require in /home/vagrant/.rbenv/versions/2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55
4303 ruby(9667): <= Kernel.require in /home/vagrant/.rbenv/versions/2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55
0 ruby(9667): => Foo.bar in test.rb:3
16 ruby(9667): <= Foo.bar in test.rb:5
</code></pre>
<p>(The output above is 2.4)</p>
<p>my ruby (all versions that I tested) was install with rb-env:</p>
<pre><code>RUBY_CONFIGURE_OPTS='--enable-dtrace --disable-install-doc' rbenv install 2.5.0
</code></pre>
<p>I am happy to provide details if required. I'd also be happy to fix it if I have guidance.</p>
<p>Thanks,</p> Ruby master - Bug #14364 (Open): Regexp last match variable in procshttps://bugs.ruby-lang.org/issues/143642018-01-16T17:23:09Zaardvark179 (Duncan MacGregor)
<p>While working on TruffleRuby's regexp variables implementation I found the following behaviour when comparing our behaviour with MRI 2.3.5 and 2.5.0.</p>
<p>Some core methods such as <code>String#scan</code> take an optional block argument, and if this is a literal block then each time it is yielded to the <code>$~</code> variable will have been set. However, if the block is a proc that was not defined in the caller's scope then <code>$~</code> does not appear to get set or is inaccessible.</p>
<p>The following test script demonstrates the problem.</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="k">class</span> <span class="nc">ScanChecker</span>
<span class="k">def</span> <span class="nf">block</span>
<span class="no">Proc</span><span class="p">.</span><span class="nf">new</span> <span class="k">do</span>
<span class="nb">puts</span> <span class="s2">"$~ is </span><span class="si">#{</span><span class="vg">$~</span><span class="si">}</span><span class="s2">"</span>
<span class="k">end</span>
<span class="k">end</span>
<span class="k">end</span>
<span class="nb">puts</span> <span class="s1">'Checking with literal block.'</span>
<span class="s1">'hello'</span><span class="p">.</span><span class="nf">scan</span><span class="p">(</span><span class="sr">/l/</span><span class="p">)</span> <span class="k">do</span>
<span class="nb">puts</span> <span class="s2">"$~ is </span><span class="si">#{</span><span class="vg">$~</span><span class="si">}</span><span class="s2">"</span>
<span class="k">end</span>
<span class="nb">puts</span> <span class="s1">'Checking with a Proc from same scope'</span>
<span class="n">my_proc</span> <span class="o">=</span> <span class="no">Proc</span><span class="p">.</span><span class="nf">new</span> <span class="k">do</span>
<span class="nb">puts</span> <span class="s2">"$~ is </span><span class="si">#{</span><span class="vg">$~</span><span class="si">}</span><span class="s2">"</span>
<span class="k">end</span>
<span class="s1">'hello'</span><span class="p">.</span><span class="nf">scan</span><span class="p">(</span><span class="sr">/l/</span><span class="p">,</span> <span class="o">&</span><span class="n">my_proc</span><span class="p">)</span>
<span class="nb">puts</span> <span class="s1">'Checking with a Proc.'</span>
<span class="n">checker</span> <span class="o">=</span> <span class="no">ScanChecker</span><span class="p">.</span><span class="nf">new</span>
<span class="s1">'hello'</span><span class="p">.</span><span class="nf">scan</span><span class="p">(</span><span class="sr">/l/</span><span class="p">,</span> <span class="o">&</span><span class="n">checker</span><span class="p">.</span><span class="nf">block</span><span class="p">)</span>
</code></pre>
<p>I would have expected the <code>$~</code> to be set in all cases, but I'm not sure if that is the intended behaviour.</p> Ruby master - Bug #12689 (Open): Thread isolation of $~ and $_https://bugs.ruby-lang.org/issues/126892016-08-19T06:37:18Zheadius (Charles Nutter)headius@headius.com
<p>We are debating what is correct behavior now, and what should be correct behavior in the future, for the thread-visibility of the special variables <code>%~</code> and <code>$_</code></p>
<p>We have several examples from <a href="https://github.com/jruby/jruby/issues/3031" class="external">https://github.com/jruby/jruby/issues/3031</a> that seem to exhibit conflicting behavior...or at least the behavior is unexpected in many cases.</p>
<pre><code>$ ruby23 -e 'p = proc { p $~; "foo" =~ /foo/ }; Thread.new {p.call}.join; Thread.new{p.call}.join'
nil
nil
$ ruby23 -e 'def foo; proc { p $~; "foo" =~ /foo/ }; end; p = foo; Thread.new {p.call}.join; Thread.new{p.call}.join'
nil
#<MatchData "foo">
$ ruby23 -e 'p = proc { p $~; "foo" =~ /foo/ }; def foo(p); Thread.new {p.call}.join; Thread.new{p.call}.join; end; foo(p)'
nil
#<MatchData "foo">
$ ruby23 -e 'class Foo; P = proc { p $~; "foo" =~ /foo/ }; def foo; Thread.new {P.call}.join; Thread.new{P.call}.join; end; end; Foo.new.foo'
nil
#<MatchData "foo">
$ ruby23 -e 'def foo; p = proc { p $~; "foo" =~ /foo/ }; Thread.new {p.call}.join; Thread.new{p.call}.join; end; foo'
nil
nil
$ ruby23 -e 'def foo; p = proc { p $~; "foo" =~ /foo/ }; bar(p); end; def bar(p); Thread.new {p.call}.join; Thread.new{p.call}.join; end; foo'
nil
#<MatchData "foo">
</code></pre>
<p>These cases exhibit some oddities in whether $~ (and presumably $_) are shared across threads.</p>
<p>The immediate thought is that they should be both frame and thread-local...but ko1 points out that such a change would break cases like this:</p>
<pre><code>def foo
/foo/ =~ 'foo'
Proc.new{
p $~
}
end
Thread.new{
foo.call
}.join
</code></pre>
<p>So there's a clear conflict here. Users sometimes expect the $~ value to be shared across threads (at least for read, as in ko1's example) and sometimes do not want it shared at all (as in the case of <a href="https://github.com/jruby/jruby/issues/3031" class="external">https://github.com/jruby/jruby/issues/3031</a></p>
<p>Now we discuss.</p> Ruby master - Bug #10128 (Open): Quoting problem for arguments of Kernel.system, Kernel.exec on W...https://bugs.ruby-lang.org/issues/101282014-08-12T16:18:30ZMaxLap (Maxime Lapointe)hunter_spawn@hotmail.com
<p>On Windows, the methods that call shell commands and receive the parameters individually sometimes do not wrap the parameters sent in quotes.<br>
This results in Windows either splitting the parameter in 2 parameters or, worse, splitting the command in 2 commands.</p>
<p>I joined the file <em>puts_first.bat</em>, which simply outputs the first argument it received. When the parameter received was wrapped by ruby, you will see quotes, it's normal. Just run a irb from from the directory containing that file.</p>
<p>Lines that don't work properly (Using Kernel.exec will do the same thing):</p>
<pre><code># these write *hello*, then says 'world' is not recognized as an internal or external command
Kernel.system 'puts_first.bat', 'hello&world'
Kernel.system 'puts_first.bat', 'hello|world'
# these write *hello*
Kernel.system 'puts_first.bat', 'hello,world'
Kernel.system 'puts_first.bat', 'hello;world'
Kernel.system 'puts_first.bat', 'hello<world'
# this writes *hello* in the file world
Kernel.system 'puts_first.bat', 'hello>world'
# this writes *helloworld* without the ^
Kernel.system 'puts_first.bat', 'hello^world'
</code></pre>
<p>If we add a space anywhere in the above hello world strings, it will work as expected because ruby wraps the parameter if it finds a space.</p>
<pre><code># Ruby does try to wrap if it finds a double quote, but it escapes double quotes incorrectly:
# this writes *"hello\"world"*, double quotes should be escaped by putting 2 of them, so we should see: *"hello""world"*
Kernel.system 'puts_first.bat', 'hello"world'
# adding a space show the problem in action, this writes *"hello\"*
Kernel.system 'puts_first.bat', 'hello" world'
</code></pre>
<p>As a side note, the single quote is not special in Windows, so there is no need to wrap this (but I don't think it's a problem):</p>
<pre><code># this writes *"hello'world"*
Kernel.system 'puts_first.bat', "hello'world"
</code></pre>
<p>This bug also happens in 1.9.3, do you think this be backported?</p>
<p>Unless I did a mistake, this should be all of the problematic characters, I tested with every printable ascii characters.</p>
<p>Thank you</p> Ruby master - Bug #8444 (Open): Regexp vars $~ and friends are not thread localhttps://bugs.ruby-lang.org/issues/84442013-05-24T18:15:17Zjamespharaoh (James Pharaoh)james@phsys.co.uk
<p>In the docs for the Regexp special variables, <code>$~</code> and friends, it says "These global variables are thread-local and method-local variables". However the following gives an unexpected result:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="k">def</span> <span class="nf">get_proc</span>
<span class="nb">proc</span> <span class="k">do</span> <span class="o">|</span><span class="n">str</span><span class="o">|</span>
<span class="n">str</span> <span class="o">=~</span> <span class="sr">/(.+)/</span>
<span class="nb">sleep</span> <span class="mf">0.1</span>
<span class="nb">puts</span> <span class="s2">"got </span><span class="si">#{</span><span class="vg">$1</span><span class="si">}</span><span class="s2"> from </span><span class="si">#{</span><span class="n">str</span><span class="si">}</span><span class="se">\n</span><span class="s2">"</span>
<span class="k">end</span>
<span class="k">end</span>
<span class="nb">proc</span> <span class="o">=</span> <span class="n">get_proc</span>
<span class="n">t1</span> <span class="o">=</span> <span class="no">Thread</span><span class="p">.</span><span class="nf">new</span> <span class="p">{</span> <span class="nb">proc</span><span class="p">.</span><span class="nf">call</span> <span class="s2">"abc"</span> <span class="p">}</span>
<span class="n">t2</span> <span class="o">=</span> <span class="no">Thread</span><span class="p">.</span><span class="nf">new</span> <span class="p">{</span> <span class="nb">proc</span><span class="p">.</span><span class="nf">call</span> <span class="s2">"def"</span> <span class="p">}</span>
<span class="n">t1</span><span class="p">.</span><span class="nf">join</span>
<span class="n">t2</span><span class="p">.</span><span class="nf">join</span>
</code></pre>
<p>This outputs the following:</p>
<pre><code>got abc from abc
got abc from def
</code></pre>
<p>The expected result is of course:</p>
<pre><code>got abc from abc
got def from def
</code></pre>
<p>Clearly the variables are being scoped to the <code>get_proc</code> method and are being shared by both threads. This runs contrary to the documentation and also to expectations.</p>
<p>This behaviour should either be changed, or the documentation updated to reflect the actual behaviour.</p>
<p>Interestingly, the following does work as expected:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="nb">proc</span> <span class="o">=</span> <span class="nb">proc</span> <span class="k">do</span> <span class="o">|</span><span class="n">str</span><span class="o">|</span>
<span class="n">str</span> <span class="o">=~</span> <span class="sr">/(.+)/</span>
<span class="nb">sleep</span> <span class="mf">0.1</span>
<span class="nb">puts</span> <span class="s2">"got </span><span class="si">#{</span><span class="vg">$1</span><span class="si">}</span><span class="s2"> from </span><span class="si">#{</span><span class="n">str</span><span class="si">}</span><span class="se">\n</span><span class="s2">"</span>
<span class="k">end</span>
<span class="n">t1</span> <span class="o">=</span> <span class="no">Thread</span><span class="p">.</span><span class="nf">new</span> <span class="p">{</span> <span class="nb">proc</span><span class="p">.</span><span class="nf">call</span> <span class="s2">"abc"</span> <span class="p">}</span>
<span class="n">t2</span> <span class="o">=</span> <span class="no">Thread</span><span class="p">.</span><span class="nf">new</span> <span class="p">{</span> <span class="nb">proc</span><span class="p">.</span><span class="nf">call</span> <span class="s2">"def"</span> <span class="p">}</span>
<span class="n">t1</span><span class="p">.</span><span class="nf">join</span>
<span class="n">t2</span><span class="p">.</span><span class="nf">join</span>
</code></pre> Ruby master - Bug #8185 (Open): Thread/fork issuehttps://bugs.ruby-lang.org/issues/81852013-03-30T03:33:57ZAnonymous
<p>Hello all,</p>
<p>I've found an issue where calling fork inside a thread, and passing a block<br>
to the fork, causes the forked process to continue after the block. I've<br>
reproduced the issue on the following versions of ruby:<br>
ruby 2.0.0p100 (2013-03-27 revision 39954) [x86_64-darwin10.8.0]<br>
ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-darwin10.8.0]</p>
<p>Here is the script I used to reproduce:</p>
<p>1000.times do |j|<br>
puts "run #{j}"<br>
threads = []<br>
100.times do |i|<br>
threads << Thread.new(i) do |local_i|<br>
opid = fork do<br>
# exit!(true) # fixes the issue<br>
# exit(true) # doesn't fix the issue<br>
# no 'exit' also exhibits issue<br>
end<br>
::Process.waitpid(opid, 0)<br>
File.open("/tmp/test_thread_fork_#{local_i}.pid", "w") {|f| f.write<br>
"1" }<br>
end<br>
end<br>
threads.map { |t| t.join }</p>
<p>borked = false<br>
100.times do |i|<br>
fn = "/tmp/test_thread_fork_#{i}.pid"<br>
contents = File.read(fn)<br>
if contents.size > 1<br>
puts "file #{fn} was written to many times (#{contents})"<br>
borked = true<br>
end<br>
end<br>
exit(false) if borked<br>
end</p>
<p>As you can see from the comments inside the fork I can work around the<br>
issue by using "exit!". I am correct in understanding that there should be<br>
no case in which the file is written to multiple times, correct?</p>
<p>Thank you,<br>
Jason Gladish</p> Ruby master - Bug #7742 (Open): System encoding (Windows-1258) is not recognized by Ruby to conv...https://bugs.ruby-lang.org/issues/77422013-01-26T15:33:40ZMars (Hong Ha Dang )dhhmars9999@gmail.com
<p>I installed Railsinstaller in win8. After intall complete the screen set to</p>
<blockquote>
<p>configuration Railsinstaller on cmd (step 2). I give user name: DHH Mars and<br>
email: <a href="mailto:dhhma...@gmail.com" class="email">dhhma...@gmail.com</a>. It ran and have following massage:</p>
<p>C:/RailsInstaller/scripts/config_check.rb:64:in 'exist?': code converter not<br>
found <a href="Encoding::ConverterNotFoundError" class="external">Encoding::ConverterNotFoundError</a> from<br>
C:/RailsInstaller/scripts/config_check.rb:64:in 'main'</p>
<p>C:\Sites></p>
</blockquote>