diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-08-23 06:00:31 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-08-23 06:00:31 +0000 |
commit | 91866217e79574e43e130a462db25a81a976ef61 (patch) | |
tree | bcfdbd826fa9bed6a84553f28d9d67370faa6758 | |
parent | 3b0216fd901c61f278f5cf46a0f14f86d1f0151f (diff) |
* eval.c (is_defined): should not dump core for "defined?(())".
* eval.c (umethod_bind): recv can be an instance of descender of
oklass if oklass is a Module.
* hash.c (rb_hash_equal): check identiry equality first.
* variable.c (mod_av_set): detect constant overriding for built-in
classes/modules.
* marshal.c (w_object): should retrieve __member__ data from
non-singleton class.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@1706 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 21 | ||||
-rw-r--r-- | eval.c | 7 | ||||
-rw-r--r-- | file.c | 25 | ||||
-rw-r--r-- | hash.c | 1 | ||||
-rw-r--r-- | marshal.c | 12 | ||||
-rw-r--r-- | regex.c | 2 | ||||
-rw-r--r-- | variable.c | 7 | ||||
-rw-r--r-- | version.h | 4 |
8 files changed, 55 insertions, 24 deletions
@@ -1,9 +1,30 @@ +Thu Aug 23 10:10:59 2001 Yukihiro Matsumoto <matz@ruby-lang.org> + + * eval.c (is_defined): should not dump core for "defined?(())". + + * eval.c (umethod_bind): recv can be an instance of descender of + oklass if oklass is a Module. + +Wed Aug 22 23:20:03 2001 Yukihiro Matsumoto <matz@ruby-lang.org> + + * hash.c (rb_hash_equal): check identiry equality first. + Mon Aug 20 19:53:16 2001 WATANABE Hirofumi <eban@ruby-lang.org> * ext/digest/sha2/extconf.rb: fix support for cross-compiling. * mkconfig.rb: fix support for autoconf 2.52. +Mon Aug 20 16:09:05 2001 Yukihiro Matsumoto <matz@ruby-lang.org> + + * variable.c (mod_av_set): detect constant overriding for built-in + classes/modules. + +Mon Aug 20 12:43:08 2001 Yukihiro Matsumoto <matz@ruby-lang.org> + + * marshal.c (w_object): should retrieve __member__ data from + non-singleton class. + Wed Aug 17 13:55:33 2001 Usaku Nakamura <usa@ruby-lang.org> * win32/Makefile.sub: merge from 1.7: use del instead of rm. @@ -1718,6 +1718,7 @@ is_defined(self, node, buf) VALUE val; /* OK */ int state; + if (!node) return "expression"; switch (nd_type(node)) { case NODE_SUPER: case NODE_ZSUPER: @@ -6693,8 +6694,10 @@ umethod_bind(method, recv) st_lookup(RCLASS(CLASS_OF(recv))->m_tbl, data->oid, 0)) { rb_raise(rb_eTypeError, "method `%s' overridden", rb_id2name(data->oid)); } - if (!rb_obj_is_instance_of(recv, data->oklass)) { - rb_raise(rb_eTypeError, "first argument must be an instance of %s", + if (!((TYPE(data->oklass) == T_MODULE) ? + rb_obj_is_kind_of(recv, data->oklass) : + rb_obj_is_instance_of(recv, data->oklass))) { + rb_raise(rb_eTypeError, "bind argument must be an instance of %s", rb_class2name(data->oklass)); } } @@ -394,7 +394,7 @@ group_member(gid) GETGROUPS_T gid; { #if !defined(NT) - if (getgid() == gid || getegid() == gid) + if (getgid() == gid) return Qtrue; # ifdef HAVE_GETGROUPS @@ -426,31 +426,30 @@ eaccess(path, mode) { #ifdef S_IXGRP struct stat st; - static int euid = -1; + int euid; if (rb_sys_stat(path, &st) < 0) return (-1); - if (euid == -1) - euid = geteuid (); - - if (euid == 0) - { + euid = geteuid(); + if (euid == 0) { /* Root can read or write any file. */ - if (mode != X_OK) + if (!(mode & X_OK)) return 0; /* Root can execute any file that has any one of the execute bits set. */ if (st.st_mode & S_IXUGO) return 0; - } + + return -1; + } if (st.st_uid == euid) /* owner */ - mode <<= 6; - else if (group_member (st.st_gid)) - mode <<= 3; + mode <<= 6; + else if (getegid() == st.st_gid || group_member(st.st_gid)) + mode <<= 3; - if (st.st_mode & mode) return 0; + if ((st.st_mode & mode) == mode) return 0; return -1; #else /* !NT */ @@ -800,6 +800,7 @@ rb_hash_equal(hash1, hash2) { struct equal_data data; + if (hash1 == hash2) return Qtrue; if (TYPE(hash2) != T_HASH) return Qfalse; if (RHASH(hash1)->tbl->num_entries != RHASH(hash2)->tbl->num_entries) return Qfalse; @@ -144,7 +144,7 @@ w_long(x, arg) int i, len = 0; #if SIZEOF_LONG > 4 - if (!(RSHIFT(x, 32) == 0 || RSHIFT(x, 32) == -1)) { + if (!(RSHIFT(x, 31) == 0 || RSHIFT(x, 31) == -1)) { /* big long does not fit in 4 bytes */ rb_raise(rb_eTypeError, "long too big to dump"); } @@ -443,13 +443,15 @@ w_object(obj, arg, limit) w_byte(TYPE_STRUCT, arg); { long len = RSTRUCT(obj)->len; - char *path = rb_class2name(CLASS_OF(obj)); - VALUE mem; + VALUE c, mem; long i; - w_unique(path, arg); + c = CLASS_OF(obj); + w_unique(rb_class2name(c), arg); w_long(len, arg); - mem = rb_ivar_get(CLASS_OF(obj), rb_intern("__member__")); + if (FL_TEST(c, FL_SINGLETON)) + c = RCLASS(c)->super; + mem = rb_ivar_get(c, rb_intern("__member__")); if (mem == Qnil) { rb_raise(rb_eTypeError, "uninitialized struct"); } @@ -3740,6 +3740,8 @@ re_match(bufp, string_arg, size, pos, regs) int regno = *p++; /* Get which register to match against */ register unsigned char *d2, *dend2; + /* Check if there's corresponding group */ + if (regno >= num_regs) goto fail; /* Check if corresponding group is still open */ if (IS_ACTIVE(reg_info[regno])) goto fail; diff --git a/variable.c b/variable.c index c05fc11a99..2347c1e55f 100644 --- a/variable.c +++ b/variable.c @@ -1267,8 +1267,11 @@ mod_av_set(klass, id, val, isconst) if (!RCLASS(klass)->iv_tbl) { RCLASS(klass)->iv_tbl = st_init_numtable(); } - else if (isconst && st_lookup(RCLASS(klass)->iv_tbl, id, 0)) { - rb_warn("already initialized %s %s", dest, rb_id2name(id)); + else if (isconst) { + if (st_lookup(RCLASS(klass)->iv_tbl, id, 0) || + (klass == rb_cObject && st_lookup(rb_class_tbl, id, 0))) { + rb_warn("already initialized %s %s", dest, rb_id2name(id)); + } } st_insert(RCLASS(klass)->iv_tbl, id, val); @@ -1,4 +1,4 @@ #define RUBY_VERSION "1.6.4" -#define RUBY_RELEASE_DATE "2001-08-20" +#define RUBY_RELEASE_DATE "2001-08-23" #define RUBY_VERSION_CODE 164 -#define RUBY_RELEASE_CODE 20010820 +#define RUBY_RELEASE_CODE 20010823 |