Project

General

Profile

Actions

Bug #10858

closed

File.expand_path on Windows does not handle drive-current path if 2nd arg is relative

Added by djberg96 (Daniel Berger) about 9 years ago. Updated almost 9 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.2.0p43 (2015-02-06 revision 49530) [i386-mswin32_120]
[ruby-core:68130]

Description

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"

Updated by nobu (Nobuyoshi Nakada) about 9 years ago

  • Description updated (diff)
  • Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN to 2.0.0: REQUIRED, 2.1: REQUIRED, 2.2: REQUIRED
Actions #2

Updated by nobu (Nobuyoshi Nakada) about 9 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

Applied in changeset r49618.


win32/file.c: fix drive letter

  • win32/file.c (rb_file_expand_path_internal): do not make invalid
    (or ADS) path if the path has a drive letter, the result also
    should have be under it. [ruby-core:68130] [Bug #10858]

Updated by naruse (Yui NARUSE) about 9 years ago

  • Backport changed from 2.0.0: REQUIRED, 2.1: REQUIRED, 2.2: REQUIRED to 2.0.0: REQUIRED, 2.1: REQUIRED, 2.2: DONE

ruby_2_2 r49671 merged revision(s) 49618,49640.

Updated by usa (Usaku NAKAMURA) almost 9 years ago

  • Backport changed from 2.0.0: REQUIRED, 2.1: REQUIRED, 2.2: DONE to 2.0.0: REQUIRED, 2.1: DONE, 2.2: DONE

ruby_2_1 r50669 merged revision(s) 49618,49640.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0