summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--class.c4
-rw-r--r--file.c7
-rw-r--r--sample/test.rb8
4 files changed, 22 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 0d4305302d..7b90942d1d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
diff --git a/class.c b/class.c
index 32ee98be72..12d03f15e4 100644
--- a/class.c
+++ b/class.c
@@ -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);
diff --git a/file.c b/file.c
index cc443c950f..7fbe26001b 100644
--- a/file.c
+++ b/file.c
@@ -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);
diff --git a/sample/test.rb b/sample/test.rb
index 9778b6e4ca..70cd79e9b2 100644
--- a/sample/test.rb
+++ b/sample/test.rb
@@ -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)