diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | file.c | 2 | ||||
-rw-r--r-- | test/ruby/test_file_exhaustive.rb | 5 |
3 files changed, 10 insertions, 2 deletions
@@ -1,3 +1,8 @@ +Sat Sep 4 23:48:47 2010 Nobuyoshi Nakada <[email protected]> + + * file.c (rb_file_s_readlink): symlink target should be in + filesystem encoding. + Sat Sep 4 10:40:50 2010 Nobuyoshi Nakada <[email protected]> * load.c (ruby_init_ext): export for golfers. @@ -2451,7 +2451,7 @@ rb_file_s_readlink(VALUE klass, VALUE path) 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; diff --git a/test/ruby/test_file_exhaustive.rb b/test/ruby/test_file_exhaustive.rb index 4615bceb05..5a62db1124 100644 --- a/test/ruby/test_file_exhaustive.rb +++ b/test/ruby/test_file_exhaustive.rb @@ -354,11 +354,14 @@ class TestFileExhaustive < Test::Unit::TestCase 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 |