[前][次][番号順一覧][スレッド一覧]

ruby-changes:37586

From: naruse <ko1@a...>
Date: Fri, 20 Feb 2015 17:59:34 +0900 (JST)
Subject: [ruby-changes:37586] naruse:r49667 (ruby_2_2): merge revision(s) 49532:

naruse	2015-02-20 17:59:19 +0900 (Fri, 20 Feb 2015)

  New Revision: 49667

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=49667

  Log:
    merge revision(s) 49532:
    
    dir.c: fix escaping multibyte char
    
    * dir.c (has_magic): fix escaping multibyte char, with glob
      meta-char in trailing bytes, e.g., Shift-JIS

  Modified directories:
    branches/ruby_2_2/
  Modified files:
    branches/ruby_2_2/dir.c
    branches/ruby_2_2/test/ruby/test_dir_m17n.rb
    branches/ruby_2_2/version.h
Index: ruby_2_2/dir.c
===================================================================
--- ruby_2_2/dir.c	(revision 49666)
+++ ruby_2_2/dir.c	(revision 49667)
@@ -1208,9 +1208,9 @@ has_magic(const char *p, const char *pen https://github.com/ruby/ruby/blob/trunk/ruby_2_2/dir.c#L1208
 	    return MAGICAL;
 
 	  case '\\':
-	    if (escape && !(c = *p++))
-		return PLAIN;
-	    continue;
+	    if (escape && p++ >= pend)
+		continue;
+	    break;
 
 #ifdef _WIN32
 	  case '.':
Index: ruby_2_2/version.h
===================================================================
--- ruby_2_2/version.h	(revision 49666)
+++ ruby_2_2/version.h	(revision 49667)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/version.h#L1
 #define RUBY_VERSION "2.2.0"
 #define RUBY_RELEASE_DATE "2015-02-20"
-#define RUBY_PATCHLEVEL 68
+#define RUBY_PATCHLEVEL 69
 
 #define RUBY_RELEASE_YEAR 2015
 #define RUBY_RELEASE_MONTH 2
Index: ruby_2_2/test/ruby/test_dir_m17n.rb
===================================================================
--- ruby_2_2/test/ruby/test_dir_m17n.rb	(revision 49666)
+++ ruby_2_2/test/ruby/test_dir_m17n.rb	(revision 49667)
@@ -347,6 +347,16 @@ class TestDir_M17N < Test::Unit::TestCas https://github.com/ruby/ruby/blob/trunk/ruby_2_2/test/ruby/test_dir_m17n.rb#L347
     end
   end
 
+  def test_glob_escape_multibyte
+    name = "\x81\\".force_encoding(Encoding::Shift_JIS)
+    with_tmpdir do
+      open(name, "w") {} rescue next
+      match, = Dir.glob("#{name}*")
+      next unless match and match.encoding == Encoding::Shift_JIS
+      assert_equal([name], Dir.glob("\\#{name}*"))
+    end
+  end
+
   def test_entries_compose
     bug7267 = '[ruby-core:48745] [Bug #7267]'
 

Property changes on: ruby_2_2
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r49532


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]