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

ruby-changes:22816

From: naruse <ko1@a...>
Date: Thu, 1 Mar 2012 18:41:20 +0900 (JST)
Subject: [ruby-changes:22816] naruse:r34865 (ruby_1_9_3): merge revision(s) r33525: [Backport #6104]

naruse	2012-03-01 18:41:08 +0900 (Thu, 01 Mar 2012)

  New Revision: 34865

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

  Log:
    merge revision(s) r33525: [Backport #6104]
    
    * file.c (rb_file_join): honor input encodings than ASCII-8BIT.
      [ruby-core:40338] [Bug #5483]

  Modified files:
    branches/ruby_1_9_3/ChangeLog
    branches/ruby_1_9_3/file.c
    branches/ruby_1_9_3/test/ruby/test_path.rb
    branches/ruby_1_9_3/version.h

Index: ruby_1_9_3/ChangeLog
===================================================================
--- ruby_1_9_3/ChangeLog	(revision 34864)
+++ ruby_1_9_3/ChangeLog	(revision 34865)
@@ -1,3 +1,8 @@
+Thu Mar  1 18:39:44 2012  Nobuyoshi Nakada  <nobu@r...>
+
+	* file.c (rb_file_join): honor input encodings than ASCII-8BIT.
+	  [ruby-core:40338] [Bug #5483]
+
 Tue Feb 28 11:56:52 2012  Nobuyoshi Nakada  <nobu@r...>
 
 	* configure.in (debugflags): check if -ggdb is accepted.
Index: ruby_1_9_3/version.h
===================================================================
--- ruby_1_9_3/version.h	(revision 34864)
+++ ruby_1_9_3/version.h	(revision 34865)
@@ -1,10 +1,10 @@
 #define RUBY_VERSION "1.9.3"
-#define RUBY_PATCHLEVEL 153
+#define RUBY_PATCHLEVEL 154
 
-#define RUBY_RELEASE_DATE "2012-02-28"
+#define RUBY_RELEASE_DATE "2012-03-01"
 #define RUBY_RELEASE_YEAR 2012
-#define RUBY_RELEASE_MONTH 2
-#define RUBY_RELEASE_DAY 28
+#define RUBY_RELEASE_MONTH 3
+#define RUBY_RELEASE_DAY 1
 
 #include "ruby/version.h"
 
Index: ruby_1_9_3/test/ruby/test_path.rb
===================================================================
--- ruby_1_9_3/test/ruby/test_path.rb	(revision 34864)
+++ ruby_1_9_3/test/ruby/test_path.rb	(revision 34865)
@@ -247,4 +247,13 @@
     assert_raise(Encoding::CompatibilityError) {open(s.encode("utf-32be"))}
     assert_raise(Encoding::CompatibilityError) {open(s.encode("utf-32le"))}
   end
+
+  def test_join
+    bug5483 = '[ruby-core:40338]'
+    path = %w[a b]
+    Encoding.list.each do |e|
+      next unless e.ascii_compatible?
+      assert_equal(e, File.join(*path.map {|s| s.force_encoding(e)}).encoding, bug5483)
+    end
+  end
 end
Index: ruby_1_9_3/file.c
===================================================================
--- ruby_1_9_3/file.c	(revision 34864)
+++ ruby_1_9_3/file.c	(revision 34865)
@@ -3837,7 +3837,10 @@
 	    FilePathStringValue(tmp);
 	}
 	name = StringValueCStr(result);
-	if (i > 0 && !NIL_P(sep)) {
+	if (i == 0) {
+	    rb_enc_copy(result, tmp);
+	}
+	else if (!NIL_P(sep)) {
 	    tail = chompdirsep(name);
 	    if (RSTRING_PTR(tmp) && isdirsep(RSTRING_PTR(tmp)[0])) {
 		rb_str_set_len(result, tail - name);

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

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