summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-08-23 06:00:31 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-08-23 06:00:31 +0000
commit91866217e79574e43e130a462db25a81a976ef61 (patch)
treebcfdbd826fa9bed6a84553f28d9d67370faa6758
parent3b0216fd901c61f278f5cf46a0f14f86d1f0151f (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--ChangeLog21
-rw-r--r--eval.c7
-rw-r--r--file.c25
-rw-r--r--hash.c1
-rw-r--r--marshal.c12
-rw-r--r--regex.c2
-rw-r--r--variable.c7
-rw-r--r--version.h4
8 files changed, 55 insertions, 24 deletions
diff --git a/ChangeLog b/ChangeLog
index bd3d100c17..df88ed263b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
diff --git a/eval.c b/eval.c
index 795dc9bead..1eacfca3f5 100644
--- a/eval.c
+++ b/eval.c
@@ -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));
}
}
diff --git a/file.c b/file.c
index cc2f2a84dc..e65c53f7c6 100644
--- a/file.c
+++ b/file.c
@@ -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 */
diff --git a/hash.c b/hash.c
index 4a829ab156..31c57fe331 100644
--- a/hash.c
+++ b/hash.c
@@ -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;
diff --git a/marshal.c b/marshal.c
index 87f65b2d57..af62919f41 100644
--- a/marshal.c
+++ b/marshal.c
@@ -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");
}
diff --git a/regex.c b/regex.c
index c5763e4c5a..0b8f56454e 100644
--- a/regex.c
+++ b/regex.c
@@ -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);
diff --git a/version.h b/version.h
index b301b7e8fa..f24e50a0b4 100644
--- a/version.h
+++ b/version.h
@@ -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