[ruby-core:68130] [Ruby trunk - Bug #10858] [Open] File.expand_path on Windows does not handle drive-current path if 2nd arg is relative

0 views
Skip to first unread message

djbe...@gmail.com

unread,
Feb 16, 2015, 5:14:00 PM2/16/15
to ruby...@ruby-lang.org
Issue #10858 has been reported by Daniel Berger.

----------------------------------------
Bug #10858: File.expand_path on Windows does not handle drive-current path if 2nd arg is relative
https://bugs.ruby-lang.org/issues/10858

* Author: Daniel Berger
* Status: Open
* Priority: Normal
* Assignee:
* ruby -v: ruby 2.2.0p43 (2015-02-06 revision 49530) [i386-mswin32_120]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
On Windows, if the first argument to File.expand_path is a drive-current path, and the dir argument is relative, you get a bogus result:

irb(main):001:0> File.expand_path("c:foo", "bar")
=> "C:/Users/djberge/Repositories/bar/c:foo"

Compare that with Ruby 1.8:

irb(main):002:0> RUBY_VERSION
=> "1.8.7"
irb(main):003:0> File.expand_path('c:foo', "bar")
=> "C:/Users/djberge/Repositories/bar/foo"



--
https://bugs.ruby-lang.org/

no...@ruby-lang.org

unread,
Feb 16, 2015, 8:52:59 PM2/16/15
to ruby...@ruby-lang.org
Issue #10858 has been updated by Nobuyoshi Nakada.

Description updated
Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN to 2.0.0: REQUIRED, 2.1: REQUIRED, 2.2: REQUIRED

----------------------------------------
Bug #10858: File.expand_path on Windows does not handle drive-current path if 2nd arg is relative
https://bugs.ruby-lang.org/issues/10858#change-51514

* Author: Daniel Berger
* Status: Open
* Priority: Normal
* Assignee:
* ruby -v: ruby 2.2.0p43 (2015-02-06 revision 49530) [i386-mswin32_120]
* Backport: 2.0.0: REQUIRED, 2.1: REQUIRED, 2.2: REQUIRED
----------------------------------------
On Windows, if the first argument to File.expand_path is a drive-current path, and the dir argument is relative, you get a bogus result:

~~~ruby
irb(main):001:0> File.expand_path("c:foo", "bar")
=> "C:/Users/djberge/Repositories/bar/c:foo"
~~~

Compare that with Ruby 1.8:

~~~ruby
irb(main):002:0> RUBY_VERSION
=> "1.8.7"
irb(main):003:0> File.expand_path('c:foo', "bar")
=> "C:/Users/djberge/Repositories/bar/foo"
~~~



--
https://bugs.ruby-lang.org/
Reply all
Reply to author
Forward
0 new messages