Ruby Issue Tracking System: Issueshttps://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112018-01-26T16:29:50ZRuby Issue Tracking System
Redmine Ruby master - Bug #14406 (Rejected): File.expand_path doesn't expand tilde inside Windows home di...https://bugs.ruby-lang.org/issues/144062018-01-26T16:29:50Zabotalov (Andrei Botalov)botalov.andrey@gmail.com
<p>TMP environment variable on Windows is set to a name that contains a tilde. <code>File.expand_path</code> doesn't currently return an expanded name. I would expect it to do so as its documentation says:<br>
"Converts a pathname to an absolute pathname."<br>
"The given pathname may start with a “~”, which expands to the process owner's home directory"</p>
<p>Example on my system:</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="mi">085</span><span class="p">:</span><span class="mi">0</span><span class="o">></span> <span class="no">File</span><span class="p">.</span><span class="nf">expand_path</span><span class="p">(</span><span class="no">Dir</span><span class="p">.</span><span class="nf">tmpdir</span><span class="p">)</span>
<span class="o">=></span> <span class="s2">"C:/Users/ANDREI~1/AppData/Local/Temp"</span>
<span class="n">irb</span><span class="p">(</span><span class="n">main</span><span class="p">):</span><span class="mi">086</span><span class="p">:</span><span class="mi">0</span><span class="o">></span> <span class="no">File</span><span class="p">.</span><span class="nf">absolute_path</span><span class="p">(</span><span class="no">Dir</span><span class="p">.</span><span class="nf">tmpdir</span><span class="p">)</span>
<span class="o">=></span> <span class="s2">"C:/Users/ANDREI~1/AppData/Local/Temp"</span>
</code></pre> Ruby master - Bug #14069 (Rejected): Document order of elements in Sethttps://bugs.ruby-lang.org/issues/140692017-10-30T12:27:37Zabotalov (Andrei Botalov)botalov.andrey@gmail.com
<p>Hash enumerates values in the insertion order.</p>
<p>Set is built on Hash so it does the same.<br>
However, this is currently believed to be a not documented implementation detail. See:<br>
<a href="https://stackoverflow.com/a/14468621/841064" class="external">https://stackoverflow.com/a/14468621/841064</a><br>
<a href="https://stackoverflow.com/questions/10361250/does-set-in-ruby-always-preserve-insertion-order#comment13351258_10361275" class="external">https://stackoverflow.com/questions/10361250/does-set-in-ruby-always-preserve-insertion-order#comment13351258_10361275</a><br>
<a href="https://spin.atomicobject.com/2012/09/04/when-is-a-set-better-than-an-array-in-ruby/" class="external">https://spin.atomicobject.com/2012/09/04/when-is-a-set-better-than-an-array-in-ruby/</a></p>
<p>I think it would be better to explicitly document that Set class enumerates keys in the insertion order.</p> Ruby master - Bug #13249 (Closed): Access modifiers don't have an effect inside class methods in ...https://bugs.ruby-lang.org/issues/132492017-02-24T19:13:46Zabotalov (Andrei Botalov)botalov.andrey@gmail.com
<p>Simple example:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="k">class</span> <span class="nc">C</span>
<span class="k">def</span> <span class="nc">self</span><span class="o">.</span><span class="nf">foo</span>
<span class="kp">private</span>
<span class="k">def</span> <span class="nf">bar</span>
<span class="k">end</span>
<span class="k">end</span>
<span class="k">end</span>
<span class="no">C</span><span class="p">.</span><span class="nf">foo</span>
<span class="no">C</span><span class="p">.</span><span class="nf">new</span><span class="p">.</span><span class="nf">bar</span>
</code></pre>
<p>This code runs fine on Ruby 2.3 and Ruby 2.4. It raises NoMethodError on Ruby 2.2 and prior versions.<br>
I would expect an error to be raised.</p>
<p>Here is some code that actually uses private access modifier inside a class method - <a href="https://github.com/evolve75/RubyTree/blob/db48c35b0a3b96e4da473b095cc00e454d8a9996/lib/tree/utils/camel_case_method_handler.rb#L60" class="external">https://github.com/evolve75/RubyTree/blob/db48c35b0a3b96e4da473b095cc00e454d8a9996/lib/tree/utils/camel_case_method_handler.rb#L60</a></p>
<p>By the way, this code raises an error as expected on Ruby 2.3 and Ruby 2.4:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="k">class</span> <span class="nc">C</span>
<span class="k">def</span> <span class="nc">self</span><span class="o">.</span><span class="nf">foo</span>
<span class="kp">private</span> <span class="k">def</span> <span class="nf">bar</span>
<span class="k">end</span>
<span class="k">end</span>
<span class="k">end</span>
<span class="no">C</span><span class="p">.</span><span class="nf">foo</span>
<span class="no">C</span><span class="p">.</span><span class="nf">new</span><span class="p">.</span><span class="nf">bar</span> <span class="c1"># NoMethodError: private method `bar' called</span>
</code></pre> Ruby master - Bug #9285 (Rejected): Exception message of Errno::ENOENT contains strings @ rb_syso...https://bugs.ruby-lang.org/issues/92852013-12-22T20:47:01Zabotalov (Andrei Botalov)botalov.andrey@gmail.com
<p>Exception message of Errno::ENOENT exception contains strings "@ rb_sysopen" or "@ dir_initialize" in Ruby 2.1.0-rc1. It doesn't contain them in Ruby 2.0. I would expect exception message not to contain those strings.</p>
<p>Example in Ruby 2.1:<br>
$ irb<br>
2.1.0dev :001 > File.new('/path/to/not/existent/file')<br>
Errno::ENOENT: No such file or directory @ rb_sysopen - /path/to/not/existent/file<br>
from (irb):1:in <code>initialize' from (irb):1:in </code>new'<br>
from (irb):1<br>
from /home/andrey/.rvm/rubies/ruby-2.1.0-rc1/bin/irb:11:in <code><main>' 2.1.0dev :002 > Dir.open('/path/to/not/existent/folder') Errno::ENOENT: No such file or directory @ dir_initialize - /path/to/not/existent/folder from (irb):2:in </code>open'<br>
from (irb):2<br>
from /home/andrey/.rvm/rubies/ruby-2.1.0-rc1/bin/irb:11:in `'<br>
2.1.0dev :003 ></p>
<p>Version: ruby 2.1.0dev (2013-12-20 trunk 44301) [x86_64-linux]<br>
It's installed via RVM.<br>
Ubuntu 13.04</p> Backport21 - Backport #9284 (Rejected): Exception message of Errno::ENOENT contains strings https://bugs.ruby-lang.org/issues/92842013-12-22T20:35:54Zabotalov (Andrei Botalov)botalov.andrey@gmail.com
<p>Exception message of Errno::ENOENT exception contains strings "@ rb_sysopen" or "@ dir_initialize". It doesn't contain them in Ruby 2.0. I would expect exception message not to contain those strings.</p>
<p>Example:<br>
$ irb<br>
2.1.0dev :001 > File.new('/path/to/not/existent/file')<br>
Errno::ENOENT: No such file or directory @ rb_sysopen - /path/to/not/existent/file<br>
from (irb):1:in <code>initialize' from (irb):1:in </code>new'<br>
from (irb):1<br>
from /home/andrey/.rvm/rubies/ruby-2.1.0-rc1/bin/irb:11:in <code><main>' 2.1.0dev :002 > Dir.open('/path/to/not/existent/folder') Errno::ENOENT: No such file or directory @ dir_initialize - /path/to/not/existent/folder from (irb):2:in </code>open'<br>
from (irb):2<br>
from /home/andrey/.rvm/rubies/ruby-2.1.0-rc1/bin/irb:11:in `'<br>
2.1.0dev :003 ></p>
<p>Version: ruby 2.1.0dev (2013-12-20 trunk 44301) [x86_64-linux]<br>
It's installed via RVM.<br>
Ubuntu 13.04</p>