Ruby Issue Tracking System: Issueshttps://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112024-03-27T17:22:36ZRuby Issue Tracking System
Redmine Ruby master - Bug #20397 (Open): The nkf license in LEGAL file seems to be obsoletehttps://bugs.ruby-lang.org/issues/203972024-03-27T17:22:36Zvo.x (Vit Ondruch)v.ondruch@tiscali.cz
<p>The LEGAL file seems to contain <a href="https://github.com/ruby/ruby/blob/a69f0047cb489c136001937442c1d2ffd8ea1dd7/LEGAL?plain=1#L730-L746" class="external">obsolete information</a> about nkf license.</p>
<p>It seems that nkf indeed use such license, but in upstream, it was first changed to <a href="https://github.com/nurse/nkf/commit/c12280757bfb275d6f9e6b0bf6293a28b060e77b" class="external">MIT</a> and then immediately to <a href="https://github.com/nurse/nkf/commit/2ed3e1c270f1deb9487f7bc7d7586030fe7dabc5" class="external">zlib</a> license.</p>
<p>Ruby has picked up that change with <a class="changeset" title="* ext/nkf/nkf-utf8/nkf.c: Update nkf to 2.0.9. revert -s meaning as Shift_JIS, etc. git-svn-id..." href="https://bugs.ruby-lang.org/projects/ruby-master/repository/git/revisions/13313688b243882aff7815598ddd9fcbae69bc17">git|13313688b243882aff7815598ddd9fcbae69bc17</a></p>
<p>Maybe <a class="user active user-mention" href="https://bugs.ruby-lang.org/users/5">@naruse (Yui NARUSE)</a> can comment about this.</p> 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 #20328 (Open): optparse omits the option's description in the --help output if ...https://bugs.ruby-lang.org/issues/203282024-03-07T22:03:25Zpostmodern (Hal Brodigan)postmodern.mod3@gmail.com
<p>If you define an option using <code>OptionParser#on</code>, but give the option's description as a multi-line Array, then the option's description is omitted from the <code>--help</code> output.</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="c1">#!/usr/bin/env ruby</span>
<span class="nb">require</span> <span class="s1">'optparse'</span>
<span class="n">optparser</span> <span class="o">=</span> <span class="no">OptionParser</span><span class="p">.</span><span class="nf">new</span> <span class="k">do</span> <span class="o">|</span><span class="n">opts</span><span class="o">|</span>
<span class="n">opts</span><span class="p">.</span><span class="nf">banner</span> <span class="o">=</span> <span class="s1">'usage: test.rb [options]'</span>
<span class="n">opts</span><span class="p">.</span><span class="nf">on</span><span class="p">(</span><span class="s1">'-o'</span><span class="p">,</span> <span class="s1">'--opt [OPT]'</span><span class="p">,</span> <span class="s1">'Line one'</span><span class="p">)</span> <span class="k">do</span> <span class="o">|</span><span class="n">opt</span><span class="o">|</span>
<span class="k">end</span>
<span class="n">opts</span><span class="p">.</span><span class="nf">on</span><span class="p">(</span><span class="s1">'-m'</span><span class="p">,</span> <span class="s1">'--multiline-opt'</span><span class="p">,</span> <span class="p">[</span><span class="s1">'Line one'</span><span class="p">,</span> <span class="s1">'Line two'</span><span class="p">])</span> <span class="k">do</span> <span class="o">|</span><span class="nb">test</span><span class="o">|</span>
<span class="k">end</span>
<span class="n">opts</span><span class="p">.</span><span class="nf">on</span><span class="p">(</span><span class="s1">'-h'</span><span class="p">,</span> <span class="s1">'--help'</span><span class="p">,</span> <span class="s1">'Prints this help'</span><span class="p">)</span> <span class="k">do</span>
<span class="nb">puts</span> <span class="n">opts</span>
<span class="nb">exit</span>
<span class="k">end</span>
<span class="k">end</span>
<span class="n">optparser</span><span class="p">.</span><span class="nf">parse</span><span class="p">([</span><span class="s1">'--help'</span><span class="p">])</span>
</code></pre>
<a name="Expected-result"></a>
<h3 >Expected result<a href="#Expected-result" class="wiki-anchor">¶</a></h3>
<pre><code>usage: test.rb [options]
-o, --opt [OPT] Line one
-m, --multiline-opt Line one
Line two
-h, --help Prints this help
</code></pre>
<a name="Actual-Result"></a>
<h3 >Actual Result<a href="#Actual-Result" class="wiki-anchor">¶</a></h3>
<pre><code>usage: test.rb [options]
-o, --opt [OPT] Line one
-m, --multiline-opt
-h, --help Prints this help
</code></pre>
<p>or an <code>ArgumentError</code> should be raised if Array descriptions are not allowed/supported.</p>
<a name="Version-Info"></a>
<h2 >Version Info<a href="#Version-Info" class="wiki-anchor">¶</a></h2>
<p>Tested against optparse 0.1.0, 0.2.0, 0.3.1, and the master branch.</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 #20294 (Open): Parser no longer warns on some duplicated keyshttps://bugs.ruby-lang.org/issues/202942024-02-22T14:09:39Zkddnewton (Kevin Newton)kddnewton@gmail.com
<p>Previously, the parser would warn on all duplicated keys. Now some cases are not handled:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="p">{</span> <span class="mf">100.0</span> <span class="o">=></span> <span class="mi">1</span><span class="p">,</span> <span class="mf">1e2</span> <span class="o">=></span> <span class="mi">1</span> <span class="p">}</span>
<span class="p">{</span> <span class="mf">100.0</span> <span class="o">=></span> <span class="mi">1</span><span class="p">,</span> <span class="mf">1E2</span> <span class="o">=></span> <span class="mi">1</span> <span class="p">}</span>
<span class="p">{</span> <span class="mf">100.0</span> <span class="o">=></span> <span class="mi">1</span><span class="p">,</span> <span class="mf">100.00</span> <span class="o">=></span> <span class="mi">1</span> <span class="p">}</span>
<span class="p">{</span> <span class="mf">100.0</span><span class="n">r</span> <span class="o">=></span> <span class="mi">1</span><span class="p">,</span> <span class="mf">100.00</span><span class="n">r</span> <span class="o">=></span> <span class="mi">1</span> <span class="p">}</span>
<span class="p">{</span> <span class="mf">100.0</span><span class="n">i</span> <span class="o">=></span> <span class="mi">1</span><span class="p">,</span> <span class="mf">100.00</span><span class="n">i</span> <span class="o">=></span> <span class="mi">1</span> <span class="p">}</span>
</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 #20243 (Open): M:N threading VM_ASSERT failure in rb_current_execution_context ...https://bugs.ruby-lang.org/issues/202432024-02-07T09:18:09Zkjtsanaktsidis (KJ Tsanaktsidis)kjtsanaktsidis@gmail.com
<p>When building with Clang 17 and <code>-DVM_CHECK_MODE=1</code> (with the following configure)</p>
<pre><code>optflags="-ggdb3 -fno-omit-frame-pointer -fno-optimize-sibling-calls -O3" cflags="-DVM_CHECK_MODE=1" CC=clang ../configure --prefix=/home/kj/ruby/installed --enable-yjit=dev --disable-install-doc
</code></pre>
<p>And then running the following script with the built <code>./miniruby</code> (which is actually from <code>bootstraptest/test_ractor.rb</code>):</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="n">counts</span> <span class="o">=</span> <span class="p">[]</span>
<span class="n">counts</span> <span class="o"><<</span> <span class="no">Ractor</span><span class="p">.</span><span class="nf">count</span>
<span class="n">ractors</span> <span class="o">=</span> <span class="p">(</span><span class="mi">1</span><span class="o">..</span><span class="mi">3</span><span class="p">).</span><span class="nf">map</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">Ractor</span><span class="p">.</span><span class="nf">receive</span> <span class="p">}</span> <span class="p">}</span>
<span class="n">counts</span> <span class="o"><<</span> <span class="no">Ractor</span><span class="p">.</span><span class="nf">count</span>
<span class="n">ractors</span><span class="p">[</span><span class="mi">0</span><span class="p">].</span><span class="nf">send</span><span class="p">(</span><span class="s1">'End 0'</span><span class="p">).</span><span class="nf">take</span>
<span class="nb">sleep</span> <span class="mf">0.1</span> <span class="k">until</span> <span class="n">ractors</span><span class="p">[</span><span class="mi">0</span><span class="p">].</span><span class="nf">inspect</span> <span class="o">=~</span> <span class="sr">/terminated/</span>
<span class="n">counts</span> <span class="o"><<</span> <span class="no">Ractor</span><span class="p">.</span><span class="nf">count</span>
<span class="n">ractors</span><span class="p">[</span><span class="mi">1</span><span class="p">].</span><span class="nf">send</span><span class="p">(</span><span class="s1">'End 1'</span><span class="p">).</span><span class="nf">take</span>
<span class="nb">sleep</span> <span class="mf">0.1</span> <span class="k">until</span> <span class="n">ractors</span><span class="p">[</span><span class="mi">1</span><span class="p">].</span><span class="nf">inspect</span> <span class="o">=~</span> <span class="sr">/terminated/</span>
<span class="n">counts</span> <span class="o"><<</span> <span class="no">Ractor</span><span class="p">.</span><span class="nf">count</span>
<span class="n">ractors</span><span class="p">[</span><span class="mi">2</span><span class="p">].</span><span class="nf">send</span><span class="p">(</span><span class="s1">'End 2'</span><span class="p">).</span><span class="nf">take</span>
<span class="nb">sleep</span> <span class="mf">0.1</span> <span class="k">until</span> <span class="n">ractors</span><span class="p">[</span><span class="mi">2</span><span class="p">].</span><span class="nf">inspect</span> <span class="o">=~</span> <span class="sr">/terminated/</span>
<span class="n">counts</span> <span class="o"><<</span> <span class="no">Ractor</span><span class="p">.</span><span class="nf">count</span>
<span class="n">counts</span><span class="p">.</span><span class="nf">inspect</span>
</code></pre>
<p>I get the following crash:</p>
<pre><code>Assertion Failed: ../vm_core.h:1957:rb_current_execution_context:ec == rb_current_ec_noinline()
ruby 3.4.0dev (2024-02-07T07:52:06Z ktsanaktsidis/igno.. 5cc6d944c2) [x86_64-linux]
-- Control frame information -----------------------------------------------
c:0003 p:0003 s:0010 e:000009 METHOD <internal:ractor>:431
c:0002 p:0004 s:0006 e:000005 BLOCK ractor_crash.rb:3 [FINISH]
c:0001 p:---- s:0003 e:000002 DUMMY [FINISH]
-- Ruby level backtrace information ----------------------------------------
ractor_crash.rb:3:in `block (2 levels) in <main>'
<internal:ractor>:431:in `receive'
-- Threading information ---------------------------------------------------
Total ractor count: 2
Ruby thread count for this ractor: 1
-- C level backtrace information -------------------------------------------
/home/kj/ruby/build/miniruby(rb_print_backtrace+0x14) [0x55faa97a4ebd] ../vm_dump.c:820
/home/kj/ruby/build/miniruby(rb_vm_bugreport) ../vm_dump.c:1151
/home/kj/ruby/build/miniruby(rb_assert_failure+0x81) [0x55faa94d2719] ../error.c:1131
./miniruby(thread_sched_wait_running_turn+0x2e9) [0x55faa9726f59]
/home/kj/ruby/build/miniruby(rb_ractor_sched_sleep+0x10b) [0x55faa972687b] ../thread_pthread.c:1348
/home/kj/ruby/build/miniruby(ractor_check_ints+0x0) [0x55faa968b328] ../ractor.c:683
/home/kj/ruby/build/miniruby(ractor_sleep_with_cleanup) ../ractor.c:684
/home/kj/ruby/build/miniruby(ractor_sleep+0x15) [0x55faa968adf4] ../ractor.c:701
/home/kj/ruby/build/miniruby(ractor_wait_receive) ../ractor.c:748
/home/kj/ruby/build/miniruby(ractor_receive+0x1f) [0x55faa968768e] ../ractor.c:762
/home/kj/ruby/build/miniruby(builtin_inline_class_431) ../ractor.rb:432
/home/kj/ruby/build/miniruby(builtin_invoker0+0x6) [0x55faa978fc66] ../vm_insnhelper.c:6746
/home/kj/ruby/build/miniruby(invoke_bf+0x39) [0x55faa979816e] ../vm_insnhelper.c:6886
/home/kj/ruby/build/miniruby(vm_invoke_builtin_delegate) ../vm_insnhelper.c:6909
/home/kj/ruby/build/miniruby(rb_vm_check_ints+0x0) [0x55faa9771fac] ../insns.def:1533
/home/kj/ruby/build/miniruby(vm_pop_frame) ../vm_insnhelper.c:419
/home/kj/ruby/build/miniruby(vm_exec_core) ../insns.def:1537
/home/kj/ruby/build/miniruby(vm_exec_loop+0x0) [0x55faa9767f02] ../vm.c:2489
/home/kj/ruby/build/miniruby(rb_vm_exec) ../vm.c:2492
/home/kj/ruby/build/miniruby(invoke_block+0x6f) [0x55faa9781a58] ../vm.c:1512
/home/kj/ruby/build/miniruby(invoke_iseq_block_from_c) ../vm.c:1582
/home/kj/ruby/build/miniruby(invoke_block_from_c_proc) ../vm.c:1680
/home/kj/ruby/build/miniruby(vm_invoke_proc) ../vm.c:1710
/home/kj/ruby/build/miniruby(rb_vm_invoke_proc_with_self+0x5a) [0x55faa9781eaa] ../vm.c:1745
/home/kj/ruby/build/miniruby(thread_do_start_proc+0x199) [0x55faa9739e19] ../thread.c:574
/home/kj/ruby/build/miniruby(thread_do_start+0x6c) [0x55faa973933f] ../thread.c:618
/home/kj/ruby/build/miniruby(thread_start_func_2) ../thread.c:668
/home/kj/ruby/build/miniruby(rb_native_mutex_lock+0x0) [0x55faa973a141] ../thread_pthread.c:2234
/home/kj/ruby/build/miniruby(thread_sched_lock_) ../thread_pthread.c:387
/home/kj/ruby/build/miniruby(call_thread_start_func_2) ../thread_pthread_mn.c:436
/home/kj/ruby/build/miniruby(co_start) ../thread_pthread_mn.c:434
</code></pre>
<p>The failing assertion is this one in vm_core.h: <a href="https://github.com/ruby/ruby/blob/42c36269403baac67b0d5dc1d6d6e31168cf6a1f/vm_core.h#L1957" class="external">https://github.com/ruby/ruby/blob/42c36269403baac67b0d5dc1d6d6e31168cf6a1f/vm_core.h#L1957</a>. It actually has a very helpful comment.</p>
<pre><code> /* On the shared objects, `__tls_get_addr()` is used to access the TLS
* and the address of the `ruby_current_ec` can be stored on a function
* frame. However, this address can be mis-used after native thread
* migration of a coroutine.
* 1) Get `ptr =&ruby_current_ec` op NT1 and store it on the frame.
* 2) Context switch and resume it on the NT2.
* 3) `ptr` is used on NT2 but it accesses to the TLS on NT1.
* This assertion checks such misusage.
*
* To avoid accidents, `GET_EC()` should be called once on the frame.
* Note that inlining can produce the problem.
*/
VM_ASSERT(ec == rb_current_ec_noinline());
</code></pre>
<p>What seems to be happening is exactly that. This is a disassembly of the relevant bits of <code>thread_sched_wait_running_turn</code>:</p>
<pre><code>........
# This is the only bits of the entire function which access the TLS base register %fs.
# It seems to have spilled the value of ruby_current_ec into %r13.
0x000055603d2e1cf8 <+136>: mov $0xffffffffffffff90,%rax
0x000055603d2e1cff <+143>: mov %fs:0x0,%r12
0x000055603d2e1d08 <+152>: add %rax,%r12
0x000055603d2e1d0b <+155>: mov %fs:(%rax),%r13
........
# There's a call to coroutine_transfer, so after this point we're returned to on a
# different thread
0x000055603d2e1e90 <+544>: call 0x55603d7fce84 <coroutine_transfer>
# But nothing ever loads the address of ruby_current_ec from %fs again (i didn't trace
# exactly the data flow from %r13 at 0x000055603d2e1d0b to here, but i assume it spilled
# somewhere and now got loaded back into %r15 here). In any case, that means %r15 here
# contains the value of ruby_current_ec from the _old_ thread, not the current one.
0x000055603d2e1e95 <+549>: mov %rbx,0x28(%r14)
0x000055603d2e1e99 <+553>: mov (%r12),%r15
0x000055603d2e1e9d <+557>: call 0x55603d33a010 <rb_current_ec_noinline>
0x000055603d2e1ea2 <+562>: cmp %rax,%r15
=> 0x000055603d2e1ea5 <+565>: jne 0x55603d2e1f3a <thread_sched_wait_running_turn+714>
........
# assertion failure code path.
0x000055603d2e1f3a <+714>: lea 0x542c0c(%rip),%rdi # 0x55603d824b4d
0x000055603d2e1f41 <+721>: lea 0x542c12(%rip),%rdx # 0x55603d824b5a
0x000055603d2e1f48 <+728>: lea 0x542c28(%rip),%rcx # 0x55603d824b77
0x000055603d2e1f4f <+735>: mov $0x7a5,%esi
0x000055603d2e1f54 <+740>: call 0x55603d08d698 <rb_assert_failure>
</code></pre>
<p>if we look at the register values from <code>0x000055603d2e1ea2</code>:</p>
<pre><code>(rr) print/x $rax
$2 = 0x55603e159ad0
(rr) print/x $r15
$3 = 0x0
</code></pre>
<p>So the value from <code>%rax</code> which came from <code>ruby_current_ec_noinline</code> is correctly the value of <code>ruby_current_ec</code> for this thread, and <code>%r15</code> contains a stale value from a previous thread.</p>
<ul>
<li>
</ul>
<p>Now, what can we <em>do</em> about this, is a different question :/ There's a really good stackoverflow answer about it here: <a href="https://stackoverflow.com/questions/75592038/how-to-disable-clang-expression-elimination-for-thread-local-variable" class="external">https://stackoverflow.com/questions/75592038/how-to-disable-clang-expression-elimination-for-thread-local-variable</a>, but to summarise</p>
<ul>
<li>longstanding GCC and Clang bugs for this exist and have been marked as WONTFIX (<a href="https://gcc.gnu.org/bugzilla/show_bug.cgi?id=26461" class="external">https://gcc.gnu.org/bugzilla/show_bug.cgi?id=26461</a>, <a href="https://github.com/llvm/llvm-project/issues/19551" class="external">https://github.com/llvm/llvm-project/issues/19551</a>)</li>
<li>It's even worse than this EC problem - things like <code>errno</code> also might be incorrectly persisted across coroutine switches (so e.g. an inlined C library function could in theory set <code>errno</code> in another thread, for example)</li>
<li>C++ actually has coroutines now, so this <em>must</em> work for those. Clang at least has fixed some TLS problems in their C++ coroutine implementation (<a href="https://github.com/llvm/llvm-project/issues/47179" class="external">https://github.com/llvm/llvm-project/issues/47179</a>)</li>
</ul>
<p>Other than reimplementing all of our coroutine stuff on top of C++ coroutines, I'm not sure what else we can do. AFAICT there's no way to tell the compiler that we clobbered the <code>%fs</code> register because that's just not a thing in its model (<a href="https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66631" class="external">https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66631</a>, but i assume clang is similar).</p>
<p>Thoughts? For now I think my workaround is to disable M:N at build time when building with ASAN (or turn optimizations down). At least this isn't a problem with <code>Fiber</code> because we never move them across threads (probably for this reason in part).</p> 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 #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 #20076 (Open): M:N scheduler is stuck on macOS with RUBY_MN_THREADS=1https://bugs.ruby-lang.org/issues/200762023-12-21T03:17:50Zhsbt (Hiroshi SHIBATA)hsbt@ruby-lang.org
<p>This is known issue. I already shared this to ko1.</p>
<p>The version of <a href="https://github.com/ruby/ruby/commit/28e3886689c71b22487dd5d0cb62f3b5ed0a77cc" class="external">https://github.com/ruby/ruby/commit/28e3886689c71b22487dd5d0cb62f3b5ed0a77cc</a> is crashed with <code>make exam</code>.</p>
<p>This is happend with webrick test on <code>make test-tool</code>.</p>
<p>My environment is macOS Sonoma 14.3 beta1 and</p>
<pre><code>$ pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
package-id: com.apple.pkg.CLTools_Executables
version: 15.1.0.0.1.1700200546
volume: /
location: /
install-time: 1702331495
</code></pre> 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 #20009 (Open): Marshal.load raises exception when load dumped class include non...https://bugs.ruby-lang.org/issues/200092023-11-19T16:26:03Zippachi (Kazuya Hatanaka)
<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="k">class</span> <span class="nc">C</span><span class="err">クラス</span><span class="p">;</span> <span class="k">end</span>
<span class="no">Marshal</span><span class="p">.</span><span class="nf">load</span><span class="p">(</span><span class="no">Marshal</span><span class="p">.</span><span class="nf">dump</span><span class="p">(</span><span class="no">C</span><span class="err">クラス</span><span class="p">))</span>
</code></pre>
<a name="Actual-result"></a>
<h2 >Actual result<a href="#Actual-result" class="wiki-anchor">¶</a></h2>
<pre><code><internal:marshal>:34:in `load': undefined class/module C\xE3\x82\xAF\xE3\x83\xA9\xE3\x82\xB9 (ArgumentError)
from marshal.rb:2:in `<main>'
</code></pre>
<a name="Expected-result"></a>
<h2 >Expected result<a href="#Expected-result" class="wiki-anchor">¶</a></h2>
<p>Returns <code>Cクラス</code></p>
<a name="Impacted-area"></a>
<h2 >Impacted area<a href="#Impacted-area" class="wiki-anchor">¶</a></h2>
<p>An exception is raised in Rails under the following conditions</p>
<ul>
<li>minitest is used with default settings</li>
<li>Parallel execution with parallelize</li>
<li>test class names contain non-ASCII characters</li>
</ul>
<p>The default parallelization uses DRb, and Marshal is used inside DRb.</p>
<a name="Other"></a>
<h2 >Other<a href="#Other" class="wiki-anchor">¶</a></h2>
<p>After trying various things, I thought I could fix it by making <code>rb_path_to_class</code> support strings containing non-ASCII characters, but I couldn't find anything more than that.</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 #19974 (Open): OpenSSL::PKCS7 generates SegFault when parsing invalid datahttps://bugs.ruby-lang.org/issues/199742023-10-26T14:17:56Zdprater (David Prater)
<p>We ran into an instance of attempting to parse invalid PKCS7 certs that consistently causes a segfault in multiple versions of Ruby 3, on multiple platforms (Linux, Mac).</p>
<h2>To reproduce:<br>
------- (within pry or irb or whatever ruby shell you prefer) ----------<br>
data = "-----BEGIN PKCS7-----\nMAsGCSqGSIb3DQEHAg==\n-----END PKCS7-----\n"<br>
OpenSSL::PKCS7.new(data).certificates</h2>
<p>This causes a segfault 100% of the time for me on both an M1 Mac as well as in docker containers running on both Mac as well as Linux hosts.</p>
<p>The issue appears to be attempting to parse empty signedData. <a href="https://lapo.it/asn1js/#MAsGCSqGSIb3DQEHAg" class="external">https://lapo.it/asn1js/#MAsGCSqGSIb3DQEHAg</a> shows that this data contains the necessary ASN1 sequence to look like a valid PKCS7 certificate. However, the signedData is empty. I assume this is the cause of the issue, but I surely don't know.</p>
<p>I've attached the info from the core dump inside a linux container running on an M1 Mac.</p> Ruby master - Bug #19922 (Open): ObjectSpace.dump_all in multiple threads in parallel causes SEGVhttps://bugs.ruby-lang.org/issues/199222023-10-12T12:56:37Zwanabe (_ wanabe)s.wanabe@gmail.com
<p><code>ObjectSpace.dump_all</code> in multiple threads in parallel causes SEGV.<br>
The reproduce code is here:</p>
<pre><code>$ ruby -robjspace -e 'def dump; 10.times { ObjectSpace.dump_all } end; Thread.new { dump }; dump'
/home/wanabe/.rbenv/versions/master/lib/ruby/3.3.0+0/objspace.rb:100: [BUG] Segmentation fault at 0x0000000000000000
(snip)
</code></pre>
<p>I attached the full log.</p>
<p>I assumed that:</p>
<ul>
<li>Thread1
<ul>
<li>calls <code>rb_objspace_reachable_objects_from_root()</code>
</li>
<li>changes <code>GET_RACTOR()->mfd</code>: mfd1</li>
<li>calls <code>dump_flush()</code>
<ul>
<li>changes current thread due to IO</li>
</ul>
</li>
</ul>
</li>
<li>Thread2
<ul>
<li>calls <code>rb_objspace_reachable_objects_from_root()</code>
</li>
<li>changes <code>GET_RACTOR()->mfd</code>: mfd2</li>
<li>calls <code>dump_flush()</code>
<ul>
<li>changes current thread due to IO</li>
</ul>
</li>
</ul>
</li>
<li>Thread1
<ul>
<li>gets unexpected <code>GET_RACTOR()->mfd</code>: mfd2</li>
</ul>
</li>
</ul> 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 #19869 (Open): Mark skipped test somehowhttps://bugs.ruby-lang.org/issues/198692023-09-08T15:01:20Zvo.x (Vit Ondruch)v.ondruch@tiscali.cz
<p>When Minitest was used to execute the Ruby test suite, skipped test were cleanly marked, e.g.:</p>
<pre><code>[14036/25715] TestGemExtCmakeBuilder#test_self_build_has_makefile = s
</code></pre>
<p>However, with the test-unit the output is:</p>
<pre><code>[14036/25715] TestGemExtCmakeBuilder#test_self_build_has_makefile = 0.01 s
</code></pre>
<p>This is problematic, because running test suite, I can see that some test were skipped:</p>
<pre><code>25705 tests, 6108213 assertions, 0 failures, 0 errors, 99 skips
</code></pre>
<p>But I can't tell which. Is there a chance to fix this?</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 #19841 (Open): Marshal.dump stack overflow with recursive Timehttps://bugs.ruby-lang.org/issues/198412023-08-18T18:53:57Zsegiddins (Samuel Giddins)segiddins@segiddins.me
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="c1">#!/usr/bin/env ruby</span>
<span class="nb">puts</span> <span class="no">RUBY_VERSION</span>
<span class="n">t</span> <span class="o">=</span> <span class="no">Time</span><span class="p">.</span><span class="nf">at</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="ss">:nanosecond</span><span class="p">)</span>
<span class="n">t</span><span class="p">.</span><span class="nf">instance_variable_set</span> <span class="ss">:@itself</span><span class="p">,</span> <span class="n">t</span>
<span class="no">Marshal</span><span class="p">.</span><span class="nf">dump</span><span class="p">(</span><span class="n">t</span><span class="p">)</span>
</code></pre>
<p>Yields a stack overflow error from the <code>Marshal.dump</code> call, even though Marshal is explicitly able to handle cyclical references</p> 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 #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 #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 #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 #19631 (Open): module_eval does not propulate absolute_path for Kernel.caller_l...https://bugs.ruby-lang.org/issues/196312023-05-06T03:06:58Zdaveola (David Stellar)
<p>I am using module_eval and noticing that since ruby 3.2 the Kernel locations do not have absolute_path for any of the eval code, though the path is available. This is a regression since at least ruby 3.0 which still works.</p>
<p>I am on 3.2.2, and here is some sample code:</p>
<pre><code>class Script < Module
script = %q{
def self.locations
Kernel.caller_locations.each { |loc|
puts "LOCATION: #{loc}"
puts "ABSPATH: #{loc.absolute_path}"
puts "PATH: #{loc.path}"
}
end
self.locations
}
module_eval(script, "/this/is/my/path", 0)
end
</code></pre>
<p>The output for the code at the top of the caller locations (inside the module_eval) is:</p>
<pre><code>LOCATION: /this/is/my/path:9:in '<class:Script>'
ABSPATH:
PATH: /this/is/my/path
</code></pre>
<p>But the absolute_path should have the correct path data as well</p> Ruby master - Bug #19609 (Open): net/http ignores open_timeout, read_timeout on Windowshttps://bugs.ruby-lang.org/issues/196092023-04-20T13:27:54Zinversion (Yura Babak)
<p>This small sample works fine on Linux (it takes 2 seconds to finish) but on Windows, it always fails with a timeout after some <strong>magical 21 seconds</strong>.</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="nb">require</span> <span class="s1">'net/http'</span>
<span class="n">uri</span> <span class="o">=</span> <span class="no">URI</span> <span class="s1">'http://1.2.3.4'</span>
<span class="n">http</span> <span class="o">=</span> <span class="no">Net</span><span class="o">::</span><span class="no">HTTP</span><span class="o">::</span><span class="n">new</span><span class="p">(</span><span class="n">uri</span><span class="p">.</span><span class="nf">host</span><span class="p">,</span> <span class="n">uri</span><span class="p">.</span><span class="nf">port</span><span class="p">)</span>
<span class="n">http</span><span class="p">.</span><span class="nf">open_timeout</span> <span class="o">=</span> <span class="mi">2</span>
<span class="n">http</span><span class="p">.</span><span class="nf">read_timeout</span> <span class="o">=</span> <span class="mi">2</span>
<span class="n">time_start</span> <span class="o">=</span> <span class="no">Time</span><span class="p">.</span><span class="nf">now</span>
<span class="k">begin</span>
<span class="n">response</span> <span class="o">=</span> <span class="n">http</span><span class="p">.</span><span class="nf">get</span> <span class="n">uri</span>
<span class="k">rescue</span> <span class="no">Exception</span>
<span class="nb">puts</span> <span class="vg">$!</span><span class="p">.</span><span class="nf">inspect</span>
<span class="k">end</span>
<span class="n">time_total</span> <span class="o">=</span> <span class="no">Time</span><span class="p">.</span><span class="nf">now</span> <span class="o">-</span> <span class="n">time_start</span>
<span class="nb">puts</span> <span class="n">time_total</span>
</code></pre>
<p>Strange that I have installed different versions and the results are not consistent:</p>
<p><strong>ruby 3.2.2</strong> (2023-03-30 revision e51014f9c0) [x64-mingw-ucrt]:</p>
<pre><code>#<Net::OpenTimeout: Failed to open TCP connection to 1.2.3.4:80 (execution expired)>
21.0494375
</code></pre>
<p><strong>ruby 3.1.2p20</strong> (2022-04-12 revision 4491bb740a) [x64-mingw-ucrt]:</p>
<pre><code>#<Net::OpenTimeout: Failed to open TCP connection to 1.2.3.4:80 (A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. - user specified timeout)>
2.0190419 # — works as expected
</code></pre>
<p><strong>ruby 3.0.1p64</strong> (2021-04-05 revision 0fb782ee38) [x64-mingw32]:</p>
<pre><code>#<Net::OpenTimeout: execution expired>
21.0423962
</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 #19268 (Open): Mingw64 Build Failurehttps://bugs.ruby-lang.org/issues/192682022-12-27T09:42:22Zcfis (Charlie Savage)
<p>For both Ruby 3.1.3 and Ruby 3.2.0, building on msys2/ucrt64 fails:</p>
<pre><code class="c syntaxhl" data-language="c"><span class="n">linking</span> <span class="n">miniruby</span><span class="p">.</span><span class="n">exe</span>
<span class="o">/</span><span class="n">usr</span><span class="o">/</span><span class="n">bin</span><span class="o">/</span><span class="n">sh</span><span class="o">:</span> <span class="o">-</span><span class="n">c</span><span class="o">:</span> <span class="n">line</span> <span class="mi">1</span><span class="o">:</span> <span class="n">syntax</span> <span class="n">error</span> <span class="n">near</span> <span class="n">unexpected</span> <span class="n">token</span> <span class="err">`</span><span class="p">(</span><span class="err">'</span>
<span class="o">/</span><span class="n">usr</span><span class="o">/</span><span class="n">bin</span><span class="o">/</span><span class="n">sh</span><span class="o">:</span> <span class="o">-</span><span class="n">c</span><span class="o">:</span> <span class="n">line</span> <span class="mi">1</span><span class="o">:</span> <span class="err">`</span><span class="o">/</span><span class="n">usr</span><span class="o">/</span><span class="n">local</span><span class="o">/</span><span class="n">ruby</span><span class="o">/</span><span class="n">bin</span><span class="o">/</span><span class="n">ruby</span> <span class="o">--</span><span class="n">disable</span><span class="o">=</span><span class="n">gems</span> <span class="o">-</span><span class="n">n</span> <span class="o">-</span><span class="n">e</span> <span class="n">BEGIN</span><span class="p">{</span><span class="n">version</span><span class="o">=</span><span class="n">ARGV</span><span class="p">.</span><span class="n">shift</span><span class="p">;</span><span class="n">mis</span><span class="o">=</span><span class="n">ARGV</span><span class="p">.</span><span class="n">dup</span><span class="p">}</span> <span class="o">-</span><span class="n">e</span> <span class="n">END</span><span class="p">{</span><span class="n">abort</span> <span class="s">"UNICODE version mismatch: #{mis}"</span> <span class="n">unless</span> <span class="n">mis</span><span class="p">.</span><span class="n">empty</span><span class="o">?</span><span class="p">}</span> <span class="o">-</span><span class="n">e</span> <span class="p">(</span><span class="n">mis</span><span class="p">.</span><span class="n">delete</span><span class="p">(</span><span class="n">ARGF</span><span class="p">.</span><span class="n">path</span><span class="p">);</span> <span class="n">ARGF</span><span class="p">.</span><span class="n">close</span><span class="p">)</span> <span class="k">if</span> <span class="o">/</span><span class="n">ONIG_UNICODE_VERSION_STRING</span> <span class="o">+</span><span class="s">"#{Regexp.quote(version)}"</span><span class="o">/</span><span class="n">o</span> <span class="mi">15</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="o">/</span><span class="n">enc</span><span class="o">/</span><span class="n">unicode</span><span class="o">/</span><span class="mi">15</span><span class="p">.</span><span class="mi">0</span><span class="p">.</span><span class="mi">0</span><span class="o">/</span><span class="n">casefold</span><span class="p">.</span><span class="n">h</span> <span class="p">.</span><span class="o">/</span><span class="n">enc</span><span class="o">/</span><span class="n">unicode</span><span class="o">/</span><span class="mi">15</span><span class="p">.</span><span class="mi">0</span><span class="p">.</span><span class="mi">0</span><span class="o">/</span><span class="n">name2ctype</span><span class="p">.</span><span class="n">h</span><span class="err">'</span>
<span class="n">make</span><span class="o">:</span> <span class="o">***</span> <span class="p">[</span><span class="n">uncommon</span><span class="p">.</span><span class="n">mk</span><span class="o">:</span><span class="mi">878</span><span class="o">:</span> <span class="p">.</span><span class="n">rbconfig</span><span class="p">.</span><span class="n">time</span><span class="p">]</span> <span class="n">Error</span> <span class="mi">2</span>
</code></pre>
<p>The fix that works for me is changing:</p>
<pre><code class="c syntaxhl" data-language="c"> <span class="o">-</span><span class="n">e</span> <span class="err">'</span><span class="p">(</span><span class="n">mis</span><span class="p">.</span><span class="n">delete</span><span class="p">(</span><span class="n">ARGF</span><span class="p">.</span><span class="n">path</span><span class="p">);</span> <span class="n">ARGF</span><span class="p">.</span><span class="n">close</span><span class="p">)</span> <span class="k">if</span> <span class="o">/</span><span class="n">ONIG_UNICODE_VERSION_STRING</span> <span class="o">+</span><span class="s">"#{Regexp.quote(version)}"</span><span class="o">/</span><span class="n">o</span><span class="err">'</span> \
</code></pre>
<p>To</p>
<pre><code class="c syntaxhl" data-language="c"> <span class="o">-</span><span class="n">e</span> <span class="s">"(mis.delete(ARGF.path); ARGF.close) if /ONIG_UNICODE_VERSION_STRING +</span><span class="se">\"</span><span class="s">#{Regexp.quote(version)}</span><span class="se">\"</span><span class="s">/o"</span> \
</code></pre>
<pre><code></code></pre> 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 #19165 (Open): Method (with no param) delegation with *, **, and ... is slowhttps://bugs.ruby-lang.org/issues/191652022-12-01T08:49:16Zmatsuda (Akira Matsuda)ronnie@dio.jp
<p>I found that method delegation via Forwardable is much slower than normal method call when delegating a method that does not take parameters.</p>
<p>Here's a benchmark that explains what I mean.</p>
<pre><code>require 'forwardable'
require 'pp'
require 'benchmark/ips'
class Obj
extend Forwardable
attr_accessor :other
def initialize
@other = Other.new
end
def foo_without_splat
@other.foo
end
def foo_with_splat(*)
@other.foo(*)
end
def foo_with_splat_with_name(*args)
@other.foo(*args)
end
def foo_with_splat_and_double_splat(*, **)
@other.foo(*, **)
end
def foo_with_triple_dots(...)
@other.foo(...)
end
delegate :foo => :@other
end
class Other
def foo() end
end
o = Obj.new
Benchmark.ips do |x|
x.report 'simple call' do
o.other.foo
end
x.report 'delegate without splat' do
o.foo_without_splat
end
x.report 'delegate with splat' do
o.foo_with_splat
end
x.report 'delegate with splat with name' do
o.foo_with_splat_with_name
end
x.report 'delegate with splat and double splat' do
o.foo_with_splat_and_double_splat
end
x.report 'delegate with triple dots' do
o.foo_with_triple_dots
end
x.report 'delegate via forwardable' do
o.foo
end
end
(result)
simple call 38.918M (± 0.9%) i/s - 194.884M
delegate without splat
31.933M (± 1.6%) i/s - 159.611M
delegate with splat 10.269M (± 1.6%) i/s - 51.631M
delegate with splat with name
9.888M (± 1.0%) i/s - 49.588M
delegate with splat and double splat
4.117M (± 0.9%) i/s - 20.696M
delegate with triple dots
4.169M (± 0.9%) i/s - 20.857M
delegate via forwardable
9.204M (± 2.1%) i/s - 46.295M
</code></pre>
<p>It shows that Method delegation with a splat is 3-4 times slower (regardless of whether the parameter is named or not), and delegation with a triple-dot literal is 9-10 times slower than a method delegation without an argument.<br>
This may be because calling a method taking a splat always assigns an Array object even when no actual argument was given, and calling a method taking triple-dots assigns five Array objects and two Hash objects (this is equivalent to <code>*, **</code>).</p>
<p>Are there any chance reducing these object assignments and making them faster? My concern is that the Rails framework heavily uses this kind of method delegations, and presumably it causes unignorable performance overhead.</p> 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 #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 #19017 (Open): Net::HTTP may block when attempting to reuse a persistent connec...https://bugs.ruby-lang.org/issues/190172022-09-22T20:56:35Zjoshc (Josh C)josh.nw@gmail.com
<p>Ruby's Net::HTTP code performs a blocking <code>Net::BufferedIO#eof?</code> check when attempting to reuse a persistent HTTP connection. See <a href="https://github.com/ruby/ruby/blob/6b099328af2ae2d04cbfd06fedc36a19cdecd30d/lib/net/http.rb#L1573" class="external">https://github.com/ruby/ruby/blob/6b099328af2ae2d04cbfd06fedc36a19cdecd30d/lib/net/http.rb#L1573</a>. The bug is the check can hang for up to the HTTP <code>read_timeout</code>, which is 60 seconds by default.</p>
<p>The code calls <code>TCPSocket#wait_readable(0)</code> to see if the socket is readable before calling the blocking <code>eof?</code> method. However, it's possible for the socket to be readable with SSL Handshake records and no Application Data. So the call to <code>eof?</code> will process the SSL Handshake records, but hang since no Application Data is available.</p>
<p>The issue can be triggered if a TLS 1.3 server sends a <code>NewSessionTicket</code> sometime after Application Data is written. The attached client and server code demonstrate the problem. Note it's important that the client and server be on separate hosts otherwise <code>eof?</code> will always return immediately.</p>
<p>On the server, copy <code>Server.java</code> and <code>certs.p12</code> into a directory, install JDK 17, compile the server and run it:</p>
<pre><code>$ openssl pkcs12 -info -in certs.p12 -noout -passin pass:password
MAC: sha1, Iteration 2048
MAC length: 20, salt length: 8
PKCS7 Encrypted data: pbeWithSHA1And40BitRC2-CBC, Iteration 2048
Certificate bag
PKCS7 Data
Shrouded Keybag: pbeWithSHA1And3-KeyTripleDES-CBC, Iteration 2048
$ sudo apt install -y openjdk-17-jdk openjdk-17-jre
$ javac Server.java
$ java -Djavax.net.debug=ssl,verbose Server
Loaded pkcs12
</code></pre>
<p>On the client, copy <code>http.rb</code> and <code>ca.pem</code> into a directory, add the IP address for the server as <code>pluto</code> to <code>/etc/hosts</code>:</p>
<pre><code>$ file ca.pem
$ sudo vi /etc/hosts
...
192.168.0.10 pluto
...
$ ruby --version
ruby 2.7.6p219 (2022-04-12 revision c9c2245c0a) [x86_64-linux]
$ openssl version
OpenSSL 1.1.1f 31 Mar 2020
</code></pre>
<p>Run the client to make the first request:</p>
<pre><code>$ ruby http.rb
opening connection to pluto:8888...
opened
starting SSL for pluto:8888...
</code></pre>
<p>The server will handle request_1 and trigger a new session ticket:</p>
<pre><code>javax.net.ssl|DEBUG|10|main|2022-09-22 18:18:23.269 UTC|SSLCipher.java:466|jdk.tls.keyLimits: entry = AES/GCM/NoPadding KeyUpdate 2^37. AES/GCM/NOPADDING:KEYUPDATE = 137438953472
Connected to 37532
Handling request_0
... snip ...
javax.net.ssl|DEBUG|10|main|2022-09-22 18:18:25.310 UTC|SSLCipher.java:2024|KeyLimit write side: algorithm = AES/GCM/NOPADDING:KEYUPDATE
countdown value = 137438953472
javax.net.ssl|DEBUG|10|main|2022-09-22 18:18:25.335 UTC|SSLCipher.java:1870|KeyLimit read side: algorithm = AES/GCM/NOPADDING:KEYUPDATE
countdown value = 137438953472
read body
updated session data
javax.net.ssl|ALL|10|main|2022-09-22 18:18:25.343 UTC|SSLSocketImpl.java:1564|trigger new session ticket
wrote response
Handling request_1
</code></pre>
<p>The client will hang when trying to reuse the persistent connection:</p>
<pre><code>OSSL_DEBUG: SSL SESSION new callback added [ossl_ssl.c:963]
SSL established, protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384
<- "POST / HTTP/1.1\r\nAccept-Encoding: identity\r\nConnection: keep-alive\r\nContent-Type: text/plain\r\nAccept: */*\r\nUser-Agent: Ruby\r\nHost: pluto:8888\r\nContent-Length: 0\r\n\r\n"
<- ""
OSSL_DEBUG: SSL SESSION new callback entered [ossl_ssl.c:454]
-> "HTTP/1.1 200 OK\r\n"
-> "Content-Length: 0\r\n"
-> "\r\n"
reading 0 bytes...
-> ""
read 0 bytes
Conn keep-alive
OSSL_DEBUG: SSL SESSION new callback entered [ossl_ssl.c:454]
</code></pre>
<p>Pressing Ctrl-C shows the backtrace:</p>
<pre><code>^CTraceback (most recent call last):
11: from http.rb:10:in `<main>'
10: from /home/josh/.rbenv/versions/2.7.6/lib/ruby/2.7.0/net/http.rb:933:in `start'
9: from http.rb:17:in `block in <main>'
8: from /home/josh/.rbenv/versions/2.7.6/lib/ruby/2.7.0/net/http.rb:1294:in `post'
7: from /home/josh/.rbenv/versions/2.7.6/lib/ruby/2.7.0/net/http.rb:1506:in `send_entity'
6: from /home/josh/.rbenv/versions/2.7.6/lib/ruby/2.7.0/net/http.rb:1492:in `request'
5: from /home/josh/.rbenv/versions/2.7.6/lib/ruby/2.7.0/net/http.rb:1518:in `transport_request'
4: from /home/josh/.rbenv/versions/2.7.6/lib/ruby/2.7.0/net/http.rb:1573:in `begin_transport'
3: from /home/josh/.rbenv/versions/2.7.6/lib/ruby/2.7.0/net/protocol.rb:134:in `eof?'
2: from /home/josh/.rbenv/versions/2.7.6/lib/ruby/2.7.0/openssl/buffering.rb:300:in `eof?'
1: from /home/josh/.rbenv/versions/2.7.6/lib/ruby/2.7.0/openssl/buffering.rb:57:in `fill_rbuff'
/home/josh/.rbenv/versions/2.7.6/lib/ruby/2.7.0/openssl/buffering.rb:57:in `sysread': Interrupt
</code></pre>
<p>I get the same behavior with latest ruby too:</p>
<pre><code>$ ruby --version
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-linux]
</code></pre>
<p>Changing Net::HTTP to the following:</p>
<pre><code>elsif @socket.io.read_nonblock(0, exception: false).nil?
</code></pre>
<p>Resolves the issue:</p>
<pre><code>$ ruby http.rb
opening connection to pluto:8888...
opened
starting SSL for pluto:8888...
OSSL_DEBUG: SSL SESSION new callback added [ossl_ssl.c:963]
SSL established, protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384
<- "POST / HTTP/1.1\r\nAccept-Encoding: identity\r\nConnection: keep-alive\r\nContent-Type: text/plain\r\nAccept: */*\r\nUser-Agent: Ruby\r\nHost: pluto:8888\r\nContent-Length: 0\r\n\r\n"
<- ""
OSSL_DEBUG: SSL SESSION new callback entered [ossl_ssl.c:454]
-> "HTTP/1.1 200 OK\r\n"
-> "Content-Length: 0\r\n"
-> "\r\n"
reading 0 bytes...
-> ""
read 0 bytes
Conn keep-alive
<- "POST / HTTP/1.1\r\nAccept-Encoding: identity\r\nConnection: keep-alive\r\nContent-Type: text/plain\r\nAccept: */*\r\nUser-Agent: Ruby\r\nHost: pluto:8888\r\nContent-Length: 0\r\n\r\n"
<- ""
OSSL_DEBUG: SSL SESSION new callback entered [ossl_ssl.c:454]
-> "HTTP/1.1 200 OK\r\n"
-> "Content-Length: 0\r\n"
-> "\r\n"
reading 0 bytes...
-> ""
read 0 bytes
Conn keep-alive
</code></pre>
<p>However, based on <a href="https://github.com/ruby/ruby/pull/1089#issuecomment-159878003" class="external">https://github.com/ruby/ruby/pull/1089#issuecomment-159878003</a> that change may not be correct. Or it could be that Ruby on Windows doesn't have this issue anymore.</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 #18878 (Open): parse.y: Foo::Bar {} is inconsistently rejectedhttps://bugs.ruby-lang.org/issues/188782022-06-26T13:06:35Zqnighy (Masaki Hara)
<p>The following source doesn't parse:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="no">Foo</span><span class="o">::</span><span class="no">Bar</span> <span class="p">{}</span>
</code></pre>
<p>despite the following:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="n">bar</span> <span class="c1"># local variable or method call</span>
<span class="no">Bar</span> <span class="c1"># constant</span>
<span class="n">bar</span><span class="p">()</span> <span class="c1"># method call</span>
<span class="no">Bar</span><span class="p">()</span> <span class="c1"># method call</span>
<span class="n">bar</span> <span class="p">{}</span> <span class="c1"># method call</span>
<span class="no">Bar</span> <span class="p">{}</span> <span class="c1"># method call</span>
<span class="n">bar</span><span class="p">()</span> <span class="p">{}</span> <span class="c1"># method call</span>
<span class="no">Bar</span><span class="p">()</span> <span class="p">{}</span> <span class="c1"># method call</span>
<span class="no">Foo</span><span class="o">::</span><span class="n">bar</span> <span class="c1"># method call</span>
<span class="no">Foo</span><span class="o">::</span><span class="no">Bar</span> <span class="c1"># constant</span>
<span class="no">Foo</span><span class="o">::</span><span class="n">bar</span><span class="p">()</span> <span class="c1"># method call</span>
<span class="no">Foo</span><span class="o">::</span><span class="no">Bar</span><span class="p">()</span> <span class="c1"># method call</span>
<span class="no">Foo</span><span class="o">::</span><span class="n">bar</span> <span class="p">{}</span> <span class="c1"># method call</span>
<span class="c1"># Foo::Bar {} # SyntaxError</span>
<span class="no">Foo</span><span class="o">::</span><span class="n">bar</span><span class="p">()</span> <span class="p">{}</span> <span class="c1"># method call</span>
<span class="no">Foo</span><span class="o">::</span><span class="no">Bar</span><span class="p">()</span> <span class="p">{}</span> <span class="c1"># method call</span>
</code></pre>
<p>Especially considering <code>Bar {}</code>, this looks like a missing implementation rather than an intentional behavior.</p> 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 #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 #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 #18661 (Open): Net::HTTP behavior changed between 2.6 and 3.1 on windows.https://bugs.ruby-lang.org/issues/186612022-03-25T13:57:07Zjleblanc (Joshua LeBlanc)
<p>We are upgrading a rails application from Ruby 2.6 to Ruby 3.1 on Windows.</p>
<p>Running rails systems tests hang on Ruby 3.1, while they succeed on Ruby 2.6.</p>
<p>I tracked this down to Ruby 3.1's Net::HTTP using Socket.tcp rather than the old TCPSocket.</p>
<p>Specifically, in <code>socket.rb</code>, <code>connect_internal</code> calls <code>connect_nonblock(self, exception: false)</code>, which ultimately hangs until timing out on windows.<br>
Modifying the <code>socket.rb</code> source to use <code>connect(self)</code> instead results in a successful operation.</p>
<p>To be clear, the hanging operation is <code>socket.rb#connect_nonblock</code>, which is on line 1214</p>
<p>Reproduction:</p>
<ol>
<li>Install Ruby 3.1 on Windows - I used RubyInstaller: <a href="https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.1.1-1/rubyinstaller-devkit-3.1.1-1-x64.exe" class="external">https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.1.1-1/rubyinstaller-devkit-3.1.1-1-x64.exe</a>
</li>
<li>Clone the reproduction project: <a href="https://github.com/joshleblanc/windows_net_http_problem" class="external">https://github.com/joshleblanc/windows_net_http_problem</a>
</li>
<li>Run <code>bundle install</code>
</li>
<li>Run <code>rails test:system</code>
</li>
</ol>
<p>Chrome will open, however a connection will never be made, ultimately timing out.</p>
<p>To test this same process in earlier versions of ruby, simply create a new rails project with <code>rails new -O -J -S <name></code>, add the <code>ffi</code> and <code>tzinfo-data</code> gems to the gemfile, and scaffold a new resource. Running <code>rails test:system</code> from this point should succeed.</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 #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 #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 #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 #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 #15599 (Open): Mixing autoload and require causes deadlock and incomplete defin...https://bugs.ruby-lang.org/issues/155992019-02-12T13:40:45Zakr (Akira Tanaka)akr@fsij.org
<p>I found that mixing autoload and require causes deadlock and incomplete definition.</p>
<pre><code>% cat a.rb
class A
def a1() end
end
% cat base.rb
autoload :A, './a'
t1 = Thread.new { p A.instance_methods(false) }
t2 = Thread.new { require './a' }
t1.join
t2.join
% ruby base.rb
Traceback (most recent call last):
1: from base.rb:6:in `<main>'
base.rb:6:in `join': No live threads left. Deadlock? (fatal)
3 threads, 3 sleeps current:0x000055cc6943fde0 main thread:0x000055cc6935f4b0
* #<Thread:0x000055cc6938f190 sleep_forever>
rb_thread_t:0x000055cc6935f4b0 native:0x00007f58d256eb40 int:0
base.rb:6:in `join'
base.rb:6:in `<main>'
* #<Thread:0x000055cc6968cfc8@base.rb:3 sleep_forever>
rb_thread_t:0x000055cc69736180 native:0x00007f58ce7b3700 int:0 mutex:0x000055cc6943fde0 cond:1
depended by: tb_thread_id:0x000055cc6935f4b0
/home/akr/ruby/o0/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/home/akr/ruby/o0/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:54:in `require'
base.rb:3:in `block in <main>'
* #<Thread:0x000055cc6968ccd0@base.rb:4 sleep_forever>
rb_thread_t:0x000055cc6943fde0 native:0x00007f58ce5b1700 int:0
/tmp/a/a.rb:1:in `<top (required)>'
/home/akr/ruby/o0/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/home/akr/ruby/o0/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:54:in `require'
base.rb:4:in `block in <main>'
% ruby base.rb
[:a1]
% ruby base.rb
[]
</code></pre>
<p>The last run which prints [] means incomplete definition of A which a1 method is not defined.</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 #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 #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 #14480 (Open): miniruby crashing when compiled with -O2 or -O1 on aarch64https://bugs.ruby-lang.org/issues/144802018-02-16T08:54:55Zvo.x (Vit Ondruch)v.ondruch@tiscali.cz
<p>Recently, it is not possible to build Ruby 2.5.0 on aarch64 on Fedora Rawhide, because miniruby fails during build:</p>
<pre><code>... snip ...
./miniruby -I./lib -I. -I.ext/common -n \
-e 'BEGIN{version=ARGV.shift;mis=ARGV.dup}' \
-e 'END{abort "UNICODE version mismatch: #{mis}" unless mis.empty?}' \
-e '(mis.delete(ARGF.path); ARGF.close) if /ONIG_UNICODE_VERSION_STRING +"#{Regexp.quote(version)}"/o' \
10.0.0 ./enc/unicode/10.0.0/casefold.h ./enc/unicode/10.0.0/name2ctype.h
generating encdb.h
./miniruby -I./lib -I. -I.ext/common ./tool/generic_erb.rb -c -o encdb.h ./template/encdb.h.tmpl ./enc enc
generating prelude.c
./miniruby -I./lib -I. -I.ext/common ./tool/generic_erb.rb -I. -c -o prelude.c \
./template/prelude.c.tmpl ./prelude.rb ./gem_prelude.rb ./abrt_prelude.rb
*** stack smashing detected ***: <unknown> terminated
encdb.h updated
... snip ...
</code></pre>
<p>This might by Ruby or gcc issue. Not sure yet. However, there is already lengthy analysis available in Fedora's Bugzilla <a href="https://bugzilla.redhat.com/show_bug.cgi?id=1545239" class="external">1</a>. Would be anybody able to help to resolve this issue?</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 #9760 (Open): mkmf does not allow for linking against custom libraries when a s...https://bugs.ruby-lang.org/issues/97602014-04-19T22:15:47Zzanegray (Andrew DeMaria)ademariad@gmail.com
<p>Hi,</p>
<p>Hopefully the title is not confusing, but the short story is that mkmf outputs a makefile that first searches the default lib path before searching any user provided lib paths. This is not an issue until one tries to link against an included library whose version is different than a preexisting system library.</p>
<p>The issue cropped up while trying to install the rugged gem (libgit2 wrapper) and a full dialog on the issue can be found on github <a href="https://github.com/libgit2/rugged/issues/351" class="external">https://github.com/libgit2/rugged/issues/351</a>.</p>
<p>I was able to fix the issue with the attached patch (<a href="https://github.com/muff1nman/ruby/commit/a0c8bc32cfc11e61c5b9703bff243934c6509210" class="external">https://github.com/muff1nman/ruby/commit/a0c8bc32cfc11e61c5b9703bff243934c6509210</a>)</p> 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>