Ruby Issue Tracking System: Issues
https://redmine.ruby-lang.org/
https://redmine.ruby-lang.org/favicon.ico?1711330511
2021-01-10T13:17:37Z
Ruby Issue Tracking System
Redmine
Ruby master - Feature #17525 (Open): Implement Happy Eyeballs Version 2 (RFC8305) in Socket.tcp
https://redmine.ruby-lang.org/issues/17525
2021-01-10T13:17:37Z
Glass_saga (Masaki Matsushita)
glass.saga@gmail.com
<p><a href="https://github.com/ruby/ruby/pull/4038" class="external">https://github.com/ruby/ruby/pull/4038</a></p>
<p>This change implements Happy Eyeballs Version 2 (RFC8305) in Socket.tcp.<br>
It enables fallback from IPv6 to IPv4 without a long waiting time.</p>
Ruby master - Feature #15628 (Assigned): init_inetsock_internal should fallback to IPv4 if IPv6 i...
https://redmine.ruby-lang.org/issues/15628
2019-02-28T11:51:17Z
sonalkr132 (Aditya Prakash)
<p>Hi,</p>
<p>This is not really bug but more of a missing feature. Let me layout steps to reproduce what I am trying to achieve:</p>
<ul>
<li>Add local entries for <code>example.com</code>
</li>
</ul>
<pre><code>$ echo "::1 example.com www.example.com
127.0.0.1 example.com www.example.com" | sudo tee --append /etc/hosts
</code></pre>
<ul>
<li>Add rule to <code>DROP</code> ipv6 packets: <code>sudo ip6tables -P INPUT DROP</code>
</li>
<li>Start a server: <code>ruby -rwebrick -e 'WEBrick::HTTPServer.new(Port: 8000).start'</code>
</li>
<li>Making request using Net:HTTP with timeout (<code>Net::OpenTimeout</code>) after after 60 seconds: <code>ruby -rnet/http -e "Net::HTTP.get(URI('http://example.com:8000'))"</code>
</li>
</ul>
<p>As far as I understand, <a href="https://github.com/ruby/ruby/blob/4444025d16ae1a586eee6a0ac9bdd09e33833f3c/ext/socket/ipsocket.c#L42" class="external">init_inetsock_internal</a> needs to fallback to ipv4 for Net::HTTP.get to work. IPv6 route being broke is expected and hence, <a href="https://tools.ietf.org/html/rfc8305" class="external">RFC8305</a> recommends fallback to IPv4.<br>
Support for IPv6 fallback is spotty across languages and http clients, for example, <a href="https://github.com/golang/go/blob/master/src/net/dial.go#L47" class="external">golang supports it</a> but python doesn't, making request with <code>curl</code> works but <code>wget</code> hangs.</p>
Ruby master - Feature #13696 (Open): Add exchange and noreplace options to File.rename
https://redmine.ruby-lang.org/issues/13696
2017-06-29T03:07:38Z
Glass_saga (Masaki Matsushita)
glass.saga@gmail.com
<p>renameat2(2) introduced in linux kernel 3.15 takes following flags.</p>
<pre><code>RENAME_EXCHANGE: Atomically exchange oldpath and newpath.
RENAME_NOREPLACE: Don't overwrite newpath of the rename. Return an error if newpath already exists.
</code></pre>
<p>This change makes <code>File.rename</code> take these flags as keyword arguments.</p>
<p>Example:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="no">File</span><span class="p">.</span><span class="nf">write</span><span class="p">(</span><span class="s2">"hoge"</span><span class="p">,</span> <span class="s2">"hoge"</span><span class="p">)</span>
<span class="no">File</span><span class="p">.</span><span class="nf">write</span><span class="p">(</span><span class="s2">"fuga"</span><span class="p">,</span> <span class="s2">"fuga"</span><span class="p">)</span>
<span class="no">File</span><span class="p">.</span><span class="nf">rename</span><span class="p">(</span><span class="s2">"hoge"</span><span class="p">,</span> <span class="s2">"fuga"</span><span class="p">,</span> <span class="ss">exchange: </span><span class="kp">true</span><span class="p">)</span> <span class="c1"># atomically exchanged</span>
<span class="no">File</span><span class="p">.</span><span class="nf">read</span><span class="p">(</span><span class="s2">"fuga"</span><span class="p">)</span> <span class="c1">#=> "hoge"</span>
<span class="no">File</span><span class="p">.</span><span class="nf">rename</span><span class="p">(</span><span class="s2">"hoge"</span><span class="p">,</span> <span class="s2">"fuga"</span><span class="p">,</span> <span class="ss">noreplace: </span><span class="kp">true</span><span class="p">)</span> <span class="c1">#=> File exists @ syserr_fail2_in - fuga (Errno::EEXIST)</span>
</code></pre>
Ruby master - Feature #7148 (Assigned): Improved Tempfile w/o DelegateClass
https://redmine.ruby-lang.org/issues/7148
2012-10-12T14:04:07Z
Glass_saga (Masaki Matsushita)
glass.saga@gmail.com
<p>I propose improved <code>Tempfile</code> without <code>DelegateClass()</code>.<br>
Present <code>Tempfile</code> has following problems.</p>
<ol>
<li>
<p>confusing inspect</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="n">t</span> <span class="o">=</span> <span class="no">Tempfile</span><span class="p">.</span><span class="nf">new</span><span class="p">(</span><span class="s2">"foo"</span><span class="p">)</span> <span class="c1">#=> #<File:/tmp/foo20121012-6762-12w11to></span>
<span class="n">t</span><span class="p">.</span><span class="nf">is_a?</span> <span class="no">File</span> <span class="c1">#=> false</span>
</code></pre>
</li>
<li>
<p><code>#dup</code> doesn't duplicate <code>IO</code></p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="n">t</span> <span class="o">=</span> <span class="no">Tempfile</span><span class="p">.</span><span class="nf">new</span><span class="p">(</span><span class="s2">"foo"</span><span class="p">)</span>
<span class="n">t</span><span class="p">.</span><span class="nf">dup</span><span class="p">.</span><span class="nf">close</span>
<span class="n">t</span><span class="p">.</span><span class="nf">read</span> <span class="c1">#=> IOError: closed stream</span>
</code></pre>
</li>
<li>
<p>finalizer performs unlink even when it has been duplicated</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="n">t</span> <span class="o">=</span> <span class="no">Tempfile</span><span class="p">.</span><span class="nf">new</span><span class="p">(</span><span class="s2">"foo"</span><span class="p">)</span>
<span class="n">path</span> <span class="o">=</span> <span class="n">t</span><span class="p">.</span><span class="nf">path</span> <span class="c1">#=> "/tmp/foo20121012-7533-1q537gq"</span>
<span class="no">File</span><span class="p">.</span><span class="nf">exist?</span> <span class="n">path</span> <span class="c1">#=> true</span>
<span class="n">tt</span> <span class="o">=</span> <span class="n">t</span><span class="p">.</span><span class="nf">dup</span>
<span class="n">t</span> <span class="o">=</span> <span class="kp">nil</span>
<span class="no">GC</span><span class="p">.</span><span class="nf">start</span>
<span class="no">File</span><span class="p">.</span><span class="nf">exist?</span> <span class="n">path</span> <span class="c1">#=> false</span>
</code></pre>
</li>
</ol>
<p>I think these problems caused by using <code>DelegateClass()</code>.<br>
Therefore, I made a patch to resolve the problems.<br>
The patched Tempfile class is a subclass of File.</p>
Ruby master - Feature #2631 (Assigned): Allow IO#reopen to take a block
https://redmine.ruby-lang.org/issues/2631
2010-01-23T00:55:49Z
djberg96 (Daniel Berger)
<p>=begin<br>
Please allow IO#reopen to accept a block. This would allow users to temporarily redirect output without having to manually reset the file descriptor. For example:</p>
<p>require 'mkmf'</p>
<a name="stdout-redirected-within-block-only"></a>
<h1 >stdout redirected within block only<a href="#stdout-redirected-within-block-only" class="wiki-anchor">¶</a></h1>
<p>$stdout.reopen('/dev/null') do<br>
if have_header('foo.h')<br>
# Do stuff<br>
end<br>
end</p>
<a name="stdout-now-back-to-its-former-setting"></a>
<h1 >stdout now back to its former setting<a href="#stdout-now-back-to-its-former-setting" class="wiki-anchor">¶</a></h1>
<p>I believe this is both convenient and intuitive when one considers the IO.open also takes a block.</p>
<p>Regards,</p>
<p>Dan<br>
=end</p>