Project

General

Profile

Backport #7381 ยป 0001-backport-r37692-r37700-r37706-fix-file-expand_path-globing.diff

luislavena (Luis Lavena), 11/18/2012 03:18 AM

View differences:

ChangeLog
Sun Nov 18 02:50:12 2012 Luis Lavena <luislavena@gmail.com>
* win32/file.c (replace_to_long_name): correct logic around wildcard
characters detection and ensure wide-chars are used as pattern.
[ruby-core:49451] [Bug #7374]
Sat Nov 17 21:45:12 Luis Lavena <luislavena@gmail.com>
* win32/file.c (replace_to_long_name): skip expansion for all wildcard
characters.
[ruby-core:49451] [Bug #7374]
* test/ruby/test_file_exhaustive.rb: add more assertions to test.
Sat Nov 17 07:35:15 2012 Luis Lavena <luislavena@gmail.com>
* win32/file.c (replace_to_long_name): skip automatic path expansion
when wildcard character is used. [ruby-core:49451] [Bug #7374]
* test/ruby/test_file_exhaustive.rb: add a test for above.
Thu Nov 15 15:17:11 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
* gc.c (free_method_entry_i): method entry may be in
test/ruby/test_file_exhaustive.rb
assert_equal("#{DRIVE}/dir", File.expand_path("#{DRIVE}/./dir"))
end
def test_expand_path_does_not_expand_wildcards
assert_equal("#{DRIVE}/*", File.expand_path("./*", "#{DRIVE}/"))
assert_equal("#{Dir.pwd}/*", File.expand_path("./*", Dir.pwd))
assert_equal("#{DRIVE}/?", File.expand_path("./?", "#{DRIVE}/"))
assert_equal("#{Dir.pwd}/?", File.expand_path("./?", Dir.pwd))
end if DRIVE
def test_expand_path_does_not_modify_the_string_argument
str = "./a/b/../c"
assert_equal("#{Dir.pwd}/a/c", File.expand_path(str, Dir.pwd))
win32/file.c
return size;
}
/* skip long name conversion if path contains wildcard characters */
if (wcspbrk(pos, L"*?")) {
return size;
}
pos = *wfullpath + size - 1;
while (!IS_DIR_SEPARATOR_P(*pos) && pos != *wfullpath) {
if (!extension_len && *pos == L'.') {
    (1-1/1)