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

ruby-changes:17181

From: nobu <ko1@a...>
Date: Sat, 4 Sep 2010 23:50:10 +0900 (JST)
Subject: [ruby-changes:17181] Ruby:r29181 (trunk): * file.c (rb_file_s_readlink): symlink target should be in

nobu	2010-09-04 23:48:55 +0900 (Sat, 04 Sep 2010)

  New Revision: 29181

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

  Log:
    * file.c (rb_file_s_readlink): symlink target should be in
      filesystem encoding.

  Modified files:
    trunk/ChangeLog
    trunk/file.c
    trunk/test/ruby/test_file_exhaustive.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 29180)
+++ ChangeLog	(revision 29181)
@@ -1,3 +1,8 @@
+Sat Sep  4 23:48:47 2010  Nobuyoshi Nakada  <nobu@r...>
+
+	* file.c (rb_file_s_readlink): symlink target should be in
+	  filesystem encoding.
+
 Sat Sep  4 10:40:50 2010  Nobuyoshi Nakada  <nobu@r...>
 
 	* load.c (ruby_init_ext): export for golfers.
Index: test/ruby/test_file_exhaustive.rb
===================================================================
--- test/ruby/test_file_exhaustive.rb	(revision 29180)
+++ test/ruby/test_file_exhaustive.rb	(revision 29181)
@@ -354,11 +354,14 @@
     assert_raise(Errno::EEXIST) { File.link(@file, @file) }
   end
 
-  def test_symlink2
+  def test_readlink
     return unless @symlinkfile
     assert_equal(@file, File.readlink(@symlinkfile))
     assert_raise(Errno::EINVAL) { File.readlink(@file) }
     assert_raise(Errno::ENOENT) { File.readlink(@nofile) }
+    if fs = Encoding.find("filesystem")
+      assert_equal(fs, File.readlink(@symlinkfile).encoding)
+    end
   rescue NotImplementedError
   end
 
Index: file.c
===================================================================
--- file.c	(revision 29180)
+++ file.c	(revision 29181)
@@ -2451,7 +2451,7 @@
 	xfree(buf);
 	rb_sys_fail_path(path);
     }
-    v = rb_tainted_str_new(buf, rv);
+    v = rb_filesystem_str_new(buf, rv);
     xfree(buf);
 
     return v;

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

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