1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

merge revision(s) 37692,37700,37706: [Backport #7381]

* 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.

	* 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.

	* 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]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@38321 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
usa 2012-12-11 10:19:51 +00:00
parent 4701a70b31
commit 51f64b032a
4 changed files with 34 additions and 1 deletions

View file

@ -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

View file

@ -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))

View file

@ -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

View file

@ -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'.') {