https://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112009-03-28T17:38:19ZRuby Issue Tracking SystemRuby master - Bug #1266: relative_path broken on windowshttps://bugs.ruby-lang.org/issues/1266?journal_id=36532009-03-28T17:38:19Zcfis (Charlie Savage)
<ul><li><strong>File</strong> <a href="/attachments/332">pathname.patch</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/332/pathname.patch">pathname.patch</a> added</li></ul><p>=begin<br>
I was hoping we could raise the priority of this issue. This bug prevents Ruby's test suite from being run at all on windows:</p>
<p>:\Development\src\ruby_trunk\test>ruby runner.rb minitest\test_mini_test.rb<br>
c:/Development/ruby-1.9.1/usr/lib/ruby/1.9.1/pathname.rb:790:in <code>relative_path_from': different prefix: "c:/" and "C:/Development/src/ruby_trunk/test" (ArgumentError) from C:/Development/src/ruby_trunk/test/minitest/test_mini_test.rb:33:in </code><a href="class:TestMiniTest" class="external">class:TestMiniTest</a>'<br>
from C:/Development/src/ruby_trunk/test/minitest/test_mini_test.rb:16:in <code><top (required)>' from c:/Development/ruby-1.9.1/usr/lib/ruby/1.9.1/test/unit.rb:55:in </code>require'<br>
from c:/Development/ruby-1.9.1/usr/lib/ruby/1.9.1/test/unit.rb:55:in <code>block in setup_argv' from c:/Development/ruby-1.9.1/usr/lib/ruby/1.9.1/test/unit.rb:49:in </code>each'<br>
from c:/Development/ruby-1.9.1/usr/lib/ruby/1.9.1/test/unit.rb:49:in <code>setup_argv' from runner.rb:9:in </code>'</p>
<p>The issues is that relative path is using case-sensitive comparisons. That's right on Linux, wrong on Windows. For whatever reason on Windows <strong>FILE</strong> returns c:.. while Dir.pwd returns C:.. And thus the problem.</p>
<p>I've attahced a proposed patch. If on windows (detecting mswin or mingw) then the comparison uses casecmp instead of ==. This seems like it would also apply on OS X when having a case-insensitive HFS+ drive.<br>
=end</p> Ruby master - Bug #1266: relative_path broken on windowshttps://bugs.ruby-lang.org/issues/1266?journal_id=36552009-03-29T09:07:07Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li><li><strong>% Done</strong> changed from <i>0</i> to <i>100</i></li></ul><p>=begin<br>
Applied in changeset r23093.<br>
=end</p> Ruby master - Bug #1266: relative_path broken on windowshttps://bugs.ruby-lang.org/issues/1266?journal_id=36562009-03-29T09:25:23Zcfis (Charlie Savage)
<ul></ul><p>=begin<br>
Thanks Nobu - looks great. I didn't know about the File::FNM_SYSCASE constant.<br>
=end</p>