https://redmine.ruby-lang.org/https://redmine.ruby-lang.org/favicon.ico?17113305112010-04-27T04:51:14ZRuby Issue Tracking SystemRuby master - Feature #3185: File.expand_path repeats forward slashes at the beginning of the pathhttps://redmine.ruby-lang.org/issues/3185?journal_id=105342010-04-27T04:51:14Zujihisa (Tatsuhiro Ujihisa)
<ul></ul><p>=begin<br>
I'm not sure which is desirable behavior; eliminating repeated slashes or preserving them, but I wrote the patch.</p>
<p>$ ruby192 -ve 'p File.expand_path("//////some/dir")'<br>
ruby 1.9.2dev (2010-04-27 trunk 27505) [i386-darwin9.8.0]<br>
"/some/dir"<br>
$ ruby192 -ve 'p File.expand_path("//////some/dir", "/Foo")'<br>
ruby 1.9.2dev (2010-04-27 trunk 27505) [i386-darwin9.8.0]<br>
"/some/dir"</p>
<p>Also, this patch passes <code>make test</code> and the corresponding RubySpec.</p>
<p>$ mspec -t ruby192 core/file/expand_path_spec.rb<br>
uby 1.9.2dev (2010-04-27 trunk 27505) [i386-darwin9.8.0]<br>
................</p>
<p>Finished in 0.016287 seconds</p>
<p>1 file, 16 examples, 45 expectations, 0 failures, 0 errors<br>
=end</p> Ruby master - Feature #3185: File.expand_path repeats forward slashes at the beginning of the pathhttps://redmine.ruby-lang.org/issues/3185?journal_id=105352010-04-27T05:02:47Zujihisa (Tatsuhiro Ujihisa)
<ul></ul><p>=begin<br>
Oops. Forgot to attach the patch or failed to upload it. trying again.<br>
=end</p> Ruby master - Feature #3185: File.expand_path repeats forward slashes at the beginning of the pathhttps://redmine.ruby-lang.org/issues/3185?journal_id=105362010-04-27T08:32:09Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Rejected</i></li></ul><p>=begin<br>
Intended.<br>
I've heard that some kinds of network file systems use // to designate external directories.<br>
=end</p> Ruby master - Feature #3185: File.expand_path repeats forward slashes at the beginning of the pathhttps://redmine.ruby-lang.org/issues/3185?journal_id=105392010-04-27T09:52:45Zujihisa (Tatsuhiro Ujihisa)
<ul></ul><p>=begin<br>
Thx. I just fixed the corresponding RubySpec. <a href="http://github.com/rubyspec/rubyspec/commit/40eedde8d44ca8a34e80ea1e5d7d23e19f3e2bda" class="external">http://github.com/rubyspec/rubyspec/commit/40eedde8d44ca8a34e80ea1e5d7d23e19f3e2bda</a><br>
=end</p> Ruby master - Feature #3185: File.expand_path repeats forward slashes at the beginning of the pathhttps://redmine.ruby-lang.org/issues/3185?journal_id=105462010-04-27T10:20:46Zusa (Usaku NAKAMURA)usa@garbagecollect.jp
<ul></ul><p>=begin<br>
Hello,</p>
<p>In message "<a href="https://blade.ruby-lang.org/ruby-core/29798">[ruby-core:29798]</a> <a href="Rejected">Bug #3185</a> File.expand_path repeats forward slashes at the beginning of the path"<br>
on Apr.27,2010 08:32:09, <a href="mailto:redmine@ruby-lang.org" class="email">redmine@ruby-lang.org</a> wrote:</p>
<blockquote>
<p>Issue <a class="issue tracker-2 status-6 priority-4 priority-default closed" title="Feature: File.expand_path repeats forward slashes at the beginning of the path (Rejected)" href="https://redmine.ruby-lang.org/issues/3185">#3185</a> has been updated by Nobuyoshi Nakada.</p>
<p>Status changed from Open to Rejected</p>
<p>Intended.<br>
I've heard that some kinds of network file systems use // to designate external directories.</p>
</blockquote>
<p>It is necessary to consider UNC only in the environment that<br>
supports it.<br>
Actually, rubyspec excludes Windows from the test case.</p>
<a name="Regards"></a>
<h2 >Regards,<a href="#Regards" class="wiki-anchor">¶</a></h2>
<p>U.Nakamura <a href="mailto:usa@garbagecollect.jp" class="email">usa@garbagecollect.jp</a></p>
<p>=end</p> Ruby master - Feature #3185: File.expand_path repeats forward slashes at the beginning of the pathhttps://redmine.ruby-lang.org/issues/3185?journal_id=105542010-04-27T13:22:27Zbrixen (Brian Shirai)brixen@gmail.com
<ul></ul><p>=begin<br>
Could we please get clarification on when it is required and on what platforms? Just allowing an unlimited number of forward slashes seems unreasonable.</p>
<p>Thanks,<br>
Brian<br>
=end</p> Ruby master - Feature #3185: File.expand_path repeats forward slashes at the beginning of the pathhttps://redmine.ruby-lang.org/issues/3185?journal_id=105842010-04-28T06:48:49Zzenspider (Ryan Davis)
<ul></ul><p>=begin</p>
<p>On Apr 26, 2010, at 21:22 , Brian Ford wrote:</p>
<blockquote>
<p>Issue <a class="issue tracker-2 status-6 priority-4 priority-default closed" title="Feature: File.expand_path repeats forward slashes at the beginning of the path (Rejected)" href="https://redmine.ruby-lang.org/issues/3185">#3185</a> has been updated by Brian Ford.</p>
<p>Could we please get clarification on when it is required and on what platforms? Just allowing an unlimited number of forward slashes seems unreasonable.</p>
</blockquote>
<p>Seems reasonable to me and allows for things like this to be clean and easy:</p>
<blockquote>
<blockquote>
<p>URI.parse "file:" + File.expand_path('//path/to/../file.txt')<br>
=> #<URI::Generic:0x100620d08 URL:file://path/file.txt></p>
</blockquote>
</blockquote>
<p>=end</p> Ruby master - Feature #3185: File.expand_path repeats forward slashes at the beginning of the pathhttps://redmine.ruby-lang.org/issues/3185?journal_id=105972010-04-28T17:02:25Zbrixen (Brian Shirai)brixen@gmail.com
<ul></ul><p>=begin<br>
On Tue, Apr 27, 2010 at 2:48 PM, Ryan Davis <a href="mailto:ryand-ruby@zenspider.com" class="email">ryand-ruby@zenspider.com</a> wrote:</p>
<blockquote>
<p>On Apr 26, 2010, at 21:22 , Brian Ford wrote:</p>
<blockquote>
<p>Issue <a class="issue tracker-2 status-6 priority-4 priority-default closed" title="Feature: File.expand_path repeats forward slashes at the beginning of the path (Rejected)" href="https://redmine.ruby-lang.org/issues/3185">#3185</a> has been updated by Brian Ford.</p>
<p>Could we please get clarification on when it is required and on what platforms? Just allowing an unlimited number of forward slashes seems unreasonable.</p>
</blockquote>
<p>Seems reasonable to me and allows for things like this to be clean and easy:</p>
<blockquote>
<blockquote>
<p>URI.parse "file:" + File.expand_path('//path/to/../file.txt')<br>
=> #<URI::Generic:0x100620d08 URL:file://path/file.txt></p>
</blockquote>
</blockquote>
</blockquote>
<p>That's two, not an arbitrary number.</p>
<p>URI.parse "file:/" + File.expand_path('/path/to/../file.txt') is no less simple.</p>
<p>=end</p> Ruby master - Feature #3185: File.expand_path repeats forward slashes at the beginning of the pathhttps://redmine.ruby-lang.org/issues/3185?journal_id=106472010-04-29T16:45:01Znaruse (Yui NARUSE)naruse@airemix.jp
<ul></ul><p>=begin<br>
(2010/04/28 17:02), brian ford wrote:</p>
<blockquote>
<p>On Tue, Apr 27, 2010 at 2:48 PM, Ryan Davis<a href="mailto:ryand-ruby@zenspider.com" class="email">ryand-ruby@zenspider.com</a> wrote:</p>
<blockquote>
<p>On Apr 26, 2010, at 21:22 , Brian Ford wrote:</p>
<blockquote>
<p>Issue <a class="issue tracker-2 status-6 priority-4 priority-default closed" title="Feature: File.expand_path repeats forward slashes at the beginning of the path (Rejected)" href="https://redmine.ruby-lang.org/issues/3185">#3185</a> has been updated by Brian Ford.</p>
<p>Could we please get clarification on when it is required and on what platforms? Just allowing an unlimited number of forward slashes seems unreasonable.</p>
</blockquote>
<p>Seems reasonable to me and allows for things like this to be clean and easy:</p>
<blockquote>
<blockquote>
<p>URI.parse "file:" + File.expand_path('//path/to/../file.txt')<br>
=> #<URI::Generic:0x100620d08 URL:file://path/file.txt></p>
</blockquote>
</blockquote>
</blockquote>
<p>That's two, not an arbitrary number.</p>
<p>URI.parse "file:/" + File.expand_path('/path/to/../file.txt') is no less simple.</p>
</blockquote>
<p>This must be:</p>
<ul>
<li>
<p>file:///path/to/../file.txt</p>
</li>
<li>
<p>file://localhost/C:/foo/bar/baz.txt</p>
<p>URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]<br>
hier-part = "//" authority path-abempty<br>
/ path-absolute<br>
/ path-rootless<br>
/ path-empty</p>
</li>
</ul>
<p><a href="http://tools.ietf.org/html/rfc3986" class="external">http://tools.ietf.org/html/rfc3986</a></p>
<p>So the problem is, what is the argument of File.expand_path.</p>
<p><a href="http://en.wikipedia.org/wiki/Path_(computing)#Posix_pathname_definition" class="external">http://en.wikipedia.org/wiki/Path_(computing)#Posix_pathname_definition</a></p>
<p>--<br>
NARUSE, Yui <a href="mailto:naruse@airemix.jp" class="email">naruse@airemix.jp</a></p>
<p>=end</p>