From 6d47b8a9cc988bb210fc44ce991a0212d97296e4 Mon Sep 17 00:00:00 2001 From: matz Date: Mon, 25 Feb 2002 09:16:25 +0000 Subject: * eval.c (method_inspect): should not dump core for unbound singleton methods. * object.c (rb_mod_to_s): better description. * hash.c (env_select): should path the assoc list. * process.c (rb_syswait): thread kludge; should be fixed to support native thread. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- COPYING | 4 ++-- ChangeLog | 16 ++++++++++++++++ eval.c | 31 ++++++++++++++++++------------- hash.c | 8 ++++---- object.c | 10 +++++++++- process.c | 21 ++++++++++++++------- 6 files changed, 63 insertions(+), 27 deletions(-) diff --git a/COPYING b/COPYING index 42c8775631..870a5f22d6 100644 --- a/COPYING +++ b/COPYING @@ -17,8 +17,8 @@ You can redistribute it and/or modify it under either the terms of the GPL b) use the modified software only within your corporation or organization. - c) rename any non-standard binaries so the names do not conflict - with standard binaries, which must also be provided. + c) give non-standard binaries non-standard names, with + instructions on where to get the original software distribution. d) make other distribution arrangements with the author. diff --git a/ChangeLog b/ChangeLog index 5734fbce21..6792384973 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,12 +1,28 @@ +Mon Feb 25 15:14:01 2002 Yukihiro Matsumoto + + * eval.c (method_inspect): should not dump core for unbound + singleton methods. + + * object.c (rb_mod_to_s): better description. + Mon Feb 25 13:32:13 2002 Nobuyoshi Nakada * lib/shell.rb (Shell::expand_path): relative to @cwd. +Mon Feb 25 06:30:11 2002 Koji Arai + + * hash.c (env_select): should path the assoc list. + Sun Feb 24 17:20:22 2002 Akinori MUSHA * ext/digest/*/*.h: Merge from rough. - Avoid namespace pollution. (MD5_* -> rb_Digest_MD5_*, etc.) +Sat Feb 23 21:12:13 2002 Yukihiro Matsumoto + + * process.c (rb_syswait): thread kludge; should be fixed to + support native thread. + Fri Feb 22 21:20:53 2002 Minero Aoki * lib/net/protocol.rb: set read_timeout dynamically. diff --git a/eval.c b/eval.c index fef1c86809..e6bcdc859e 100644 --- a/eval.c +++ b/eval.c @@ -6941,28 +6941,33 @@ method_inspect(method) rb_str_buf_cat2(str, ": "); if (FL_TEST(data->klass, FL_SINGLETON)) { - VALUE v; + VALUE v = rb_iv_get(data->klass, "__attached__"); - rb_str_buf_append(str, rb_inspect(data->recv)); - v = rb_iv_get(data->klass, "__attached__"); - if (data->recv != v) { - rb_str_buf_cat2(str, "("); + if (data->recv == Qundef) { + rb_str_buf_append(str, rb_inspect(data->klass)); + } + else if (data->recv == v) { rb_str_buf_append(str, rb_inspect(v)); - rb_str_buf_cat2(str, ")."); + sharp = "."; } else { - rb_str_buf_cat2(str, "."); + rb_str_buf_append(str, rb_inspect(data->recv)); + rb_str_buf_cat2(str, "("); + rb_str_buf_append(str, rb_inspect(v)); + rb_str_buf_cat2(str, ")"); + sharp = "."; } } else { rb_str_buf_cat2(str, rb_class2name(data->rklass)); - rb_str_buf_cat2(str, "("); - s = rb_class2name(data->klass); - rb_str_buf_cat2(str, s); - rb_str_buf_cat2(str, ")#"); + if (data->rklass != data->klass) { + rb_str_buf_cat2(str, "("); + rb_str_buf_cat2(str, rb_class2name(data->klass)); + rb_str_buf_cat2(str, ")"); + } } - s = rb_id2name(data->oid); - rb_str_buf_cat2(str, s); + rb_str_buf_cat2(str, sharp); + rb_str_buf_cat2(str, rb_id2name(data->oid)); rb_str_buf_cat2(str, ">"); return str; diff --git a/hash.c b/hash.c index dda50abe12..468830a075 100644 --- a/hash.c +++ b/hash.c @@ -1327,10 +1327,10 @@ env_select(argc, argv) while (*env) { char *s = strchr(*env, '='); if (s) { - VALUE str = rb_tainted_str_new(*env, s-*env); - - if (RTEST(rb_yield(str))) { - rb_ary_push(result, str); + VALUE assoc = rb_assoc_new(rb_tainted_str_new(*env, s-*env), + rb_tainted_str_new2(s+1)); + if (RTEST(rb_yield(assoc))) { + rb_ary_push(result, assoc); } } env++; diff --git a/object.c b/object.c index 240a51c3f9..bf22075369 100644 --- a/object.c +++ b/object.c @@ -500,9 +500,17 @@ rb_mod_to_s(klass) { if (FL_TEST(klass, FL_SINGLETON)) { VALUE s = rb_str_new2("#<"); + VALUE v = rb_iv_get(klass, "__attached__"); rb_str_cat2(s, "Class:"); - rb_str_cat2(s, rb_class2name(klass)); + switch (TYPE(v)) { + case T_CLASS: case T_MODULE: + rb_str_append(s, rb_inspect(v)); + break; + default: + rb_str_append(s, rb_any_to_s(v)); + break; + } rb_str_cat2(s, ">"); return s; diff --git a/process.c b/process.c index 8da5953573..7f1375dd32 100644 --- a/process.c +++ b/process.c @@ -768,29 +768,36 @@ void rb_syswait(pid) int pid; { + static int overriding; RETSIGTYPE (*hfunc)_((int)), (*qfunc)_((int)), (*ifunc)_((int)); int status; - int i; + int i, hooked = Qfalse; + if (!overriding) { #ifdef SIGHUP - hfunc = signal(SIGHUP, SIG_IGN); + hfunc = signal(SIGHUP, SIG_IGN); #endif #ifdef SIGQUIT - qfunc = signal(SIGQUIT, SIG_IGN); + qfunc = signal(SIGQUIT, SIG_IGN); #endif - ifunc = signal(SIGINT, SIG_IGN); + ifunc = signal(SIGINT, SIG_IGN); + overriding = Qtrue; + hooked = Qtrue; + } do { i = rb_waitpid(pid, &status, 0); } while (i == -1 && errno == EINTR); + if (hooked) { #ifdef SIGHUP - signal(SIGHUP, hfunc); + signal(SIGHUP, hfunc); #endif #ifdef SIGQUIT - signal(SIGQUIT, qfunc); + signal(SIGQUIT, qfunc); #endif - signal(SIGINT, ifunc); + signal(SIGINT, ifunc); + } } static VALUE -- cgit v1.2.3