diff options
-rw-r--r-- | ChangeLog | 21 | ||||
-rw-r--r-- | test/ruby/test_file_exhaustive.rb | 7 | ||||
-rw-r--r-- | version.h | 2 | ||||
-rw-r--r-- | win32/file.c | 5 |
4 files changed, 34 insertions, 1 deletions
@@ -1,3 +1,24 @@ +Tue Dec 11 19:19:33 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. + +Tue Dec 11 19:19:33 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. + Tue Dec 11 19:18:12 2012 NAKAMURA Usaku <usa@ruby-lang.org> * win32/mkexports.rb (each_export): skip garbages generated by VS2012's diff --git a/test/ruby/test_file_exhaustive.rb b/test/ruby/test_file_exhaustive.rb index f3c36aa38b..d80c430bce 100644 --- a/test/ruby/test_file_exhaustive.rb +++ b/test/ruby/test_file_exhaustive.rb @@ -601,6 +601,13 @@ class TestFileExhaustive < Test::Unit::TestCase 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)) @@ -1,5 +1,5 @@ #define RUBY_VERSION "1.9.3" -#define RUBY_PATCHLEVEL 339 +#define RUBY_PATCHLEVEL 340 #define RUBY_RELEASE_DATE "2012-12-11" #define RUBY_RELEASE_YEAR 2012 diff --git a/win32/file.c b/win32/file.c index e3b50b450f..dfe122480f 100644 --- a/win32/file.c +++ b/win32/file.c @@ -276,6 +276,11 @@ replace_to_long_name(wchar_t **wfullpath, size_t size, int heap) 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'.') { |