summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-02-19 07:47:07 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-02-19 07:47:07 +0000
commit9eae31d5696cb796821929ff289869e94d87c840 (patch)
treefed3a1b8c969954c23bbe53f740958107edcb171
parent87dfb89d2e15b031432ae09225340331a8259a1c (diff)
* 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
-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 0d4305302dc..7b90942d1df 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 32ee98be725..12d03f15e4d 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 cc443c950fe..7fbe26001b6 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 9778b6e4cae..70cd79e9b2d 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)