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

* file.c (path_check_1): do not warn on world writable *parent*

directories.

* class.c (rb_include_module): should preserve ancestor order in
  the included class/module.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2094 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2002-02-19 07:47:07 +00:00
parent 87dfb89d2e
commit 9eae31d569
4 changed files with 22 additions and 5 deletions

View file

@ -1,3 +1,11 @@
Tue Feb 19 15:51:41 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
* file.c (path_check_1): do not warn on world writable *parent*
directories.
* class.c (rb_include_module): should preserve ancestor order in
the included class/module.
Tue Feb 19 14:45:32 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
* file.c (path_check_1): should check directory sticky bits.

View file

@ -361,8 +361,10 @@ rb_include_module(klass, module)
/* ignore if the module included already in superclasses */
for (p = RCLASS(klass)->super; p; p = RCLASS(p)->super) {
if (BUILTIN_TYPE(p) == T_ICLASS) {
if (RCLASS(p)->m_tbl == RCLASS(module)->m_tbl)
if (RCLASS(p)->m_tbl == RCLASS(module)->m_tbl) {
c = p; /* move insertion point */
goto skip;
}
}
}
RCLASS(c)->super = include_class_new(module, RCLASS(c)->super);

7
file.c
View file

@ -2307,13 +2307,12 @@ path_check_1(path)
#ifndef S_IWOTH
# define S_IWOTH 002
#endif
if (stat(p0, &st) == 0 && S_ISDIR(st.st_mode) && (st.st_mode & S_IWOTH)
if (stat(p0, &st) == 0 && S_ISDIR(st.st_mode) && (st.st_mode & S_IWOTH)) {
#ifdef S_ISVTX
&& !(st.st_mode & S_ISVTX)
if (!p || !(st.st_mode & S_ISVTX))
#endif
) {
rb_warn("Unsecure world writeable dir %s , mode 0%o", p0, st.st_mode);
if (p) *p = '/';
rb_warn("Unsecure world writeable dir %s , mode 0%o", p0, st.st_mode);
return 0;
}
s = strrdirsep(p0);

View file

@ -1242,6 +1242,14 @@ rescue NoMethodError
test_ok true
end
module M001; end
module M002; end
module M003; include M002; end
module M002; include M001; end
module M003; include M002; end
test_ok(M003.ancestors == [M003, M002, M001])
test_check "marshal"
$x = [1,2,3,[4,5,"foo"],{1=>"bar"},2.5,fact(30)]
$y = Marshal.dump($x)