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

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

filesystem encoding.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29181 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2010-09-04 14:48:55 +00:00
parent 097d58a594
commit 0fd37b09ee
3 changed files with 10 additions and 2 deletions

View file

@ -1,3 +1,8 @@
Sat Sep 4 23:48:47 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* file.c (rb_file_s_readlink): symlink target should be in
filesystem encoding.
Sat Sep 4 10:40:50 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* load.c (ruby_init_ext): export for golfers.

2
file.c
View file

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

View file

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