зеркало из https://github.com/github/ruby.git
* file.c (file_expand_path): should check if could find user.
[ruby-core:31538] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28795 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
7ae7ac4aba
Коммит
a99de84663
|
@ -1,3 +1,8 @@
|
|||
Fri Jul 30 08:33:20 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* file.c (file_expand_path): should check if could find user.
|
||||
[ruby-core:31538]
|
||||
|
||||
Fri Jul 30 07:59:53 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* util.c (ruby_add_suffix): fixed a bug returning uninitialized
|
||||
|
|
4
file.c
4
file.c
|
@ -2865,7 +2865,9 @@ file_expand_path(VALUE fname, VALUE dname, int abs_mode, VALUE result)
|
|||
buf = p + 1;
|
||||
p += s-b;
|
||||
}
|
||||
rb_home_dir(buf, result);
|
||||
if (NIL_P(rb_home_dir(buf, result))) {
|
||||
rb_raise(rb_eArgError, "can't find user %s", buf);
|
||||
}
|
||||
BUFINIT();
|
||||
p = pend;
|
||||
}
|
||||
|
|
|
@ -395,11 +395,8 @@ class TestFileExhaustive < Test::Unit::TestCase
|
|||
assert_equal(@file, File.expand_path(@file + "::$DATA"))
|
||||
end
|
||||
assert_kind_of(String, File.expand_path("~"))
|
||||
unless /mingw|mswin/ =~ RUBY_PLATFORM
|
||||
assert_raise(ArgumentError) { File.expand_path("~foo_bar_baz_unknown_user_wahaha") }
|
||||
assert_raise(ArgumentError) { File.expand_path("~foo_bar_baz_unknown_user_wahaha", "/") }
|
||||
end
|
||||
|
||||
assert_raise(ArgumentError) { File.expand_path("~foo_bar_baz_unknown_user_wahaha") }
|
||||
assert_raise(ArgumentError) { File.expand_path("~foo_bar_baz_unknown_user_wahaha", "/") }
|
||||
assert_incompatible_encoding {|d| File.expand_path(d)}
|
||||
end
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче