From 67245eec7192abdc1dd0dc2510c1f6c77df89bd0 Mon Sep 17 00:00:00 2001 From: matz Date: Sat, 8 Sep 2001 14:17:53 +0000 Subject: * eval.c (rb_thread_restore_context): save current value of lastline and lastmatch in the thread struct for later restore. * eval.c (rb_thread_save_context): restore lastline and lastmatch. * numeric.c (flo_to_s): should handle negative float value. * class.c (rb_include_module): should check whole ancestors to avoid duplicate module inclusion. * string.c (trnext): should check backslash before updating "now" position. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1746 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- COPYING | 2 +- ChangeLog | 65 +++++++++++++++++++++++++++++++++++------------------ Makefile.in | 2 +- README | 2 +- README.ja | 2 +- class.c | 16 ++++++------- dir.c | 9 +++++++- eval.c | 14 ++++++++++-- ext/digest/MANIFEST | 23 +++++++++++++++++++ file.c | 2 +- lib/resolv.rb | 5 ++++- numeric.c | 14 +++++++----- process.c | 44 +++++++++++++++++++++--------------- ruby.1 | 4 ++-- string.c | 4 ++-- version.h | 4 ++-- 16 files changed, 143 insertions(+), 69 deletions(-) diff --git a/COPYING b/COPYING index 23e12f76a0..776b142468 100644 --- a/COPYING +++ b/COPYING @@ -1,4 +1,4 @@ -Ruby is copyrighted free software by Yukihiro Matsumoto . +Ruby is copyrighted free software by Yukihiro Matsumoto . You can redistribute it and/or modify it under either the terms of the GPL (see the file GPL), or the conditions below: diff --git a/ChangeLog b/ChangeLog index 8adb8910d3..b5f11bea3d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,17 @@ Sat Sep 8 07:13:42 2001 Wakou Aoyama * lib/net/telnet.rb: waitfor(): improvement. thanks to nobu.nakada@nifty.ne.jp +Sat Sep 8 04:34:17 2001 Yukihiro Matsumoto + + * eval.c (rb_thread_restore_context): save current value of + lastline and lastmatch in the thread struct for later restore. + + * eval.c (rb_thread_save_context): restore lastline and lastmatch. + +Fri Sep 7 11:27:56 2001 akira yamada + + * numeric.c (flo_to_s): should handle negative float value. + Fri Sep 7 09:44:44 2001 Wakou Aoyama * lib/net/telnet.rb: waitfor(): bug fix. @@ -31,28 +42,6 @@ Thu Sep 6 14:25:15 2001 Akinori MUSHA * ext/digest/digest.c (rb_digest_base_s_hexdigest): remove a debug print. -Sun Aug 26 20:26:40 2001 Koji Arai - - * ext/readline/readline.c: restore terminal mode - even if readline() interrupted. - - * ext/readline/readline.c: returned string need to - be tainted. - - * ext/readline/readline.c: fixed memory leak. - - * ext/readline/readline.c: allow negative index. - - * ext/readline/readline.c: added Readline::HISTORY.size - same as Readline::HISTORY.length - - * ext/readline/readline.c: allow conditional parsing - of the ~/.inputrc file by `$if Ruby'. - - * ext/readline/extconf.rb: check whether the - libreadline has the variable `rl_completion_append_character' - (this feature was implemented from GNU readline 2.1). - Thu Sep 6 13:56:14 2001 Akinori MUSHA * ext/digest/digest.c (rb_digest_base_s_digest, @@ -72,6 +61,16 @@ Thu Sep 6 07:16:14 2001 Nobuyoshi Nakada * ext/socket/socket.c (Init_socket): remove duplicating constants. +Thu Sep 6 03:15:24 2001 Yukihiro Matsumoto + + * class.c (rb_include_module): should check whole ancestors to + avoid duplicate module inclusion. + +Wed Sep 5 20:02:27 2001 Shin'ya Adzumi + + * string.c (trnext): should check backslash before updating "now" + position. + Wed Sep 5 17:41:11 2001 WATANABE Hirofumi * lib/jcode.rb (_regexp_quote): fix quote handling. @@ -7205,6 +7204,28 @@ Fri Aug 28 17:32:55 1999 Yasuhiro Fukuma * eval.c (rb_eval): should set return value (nil) explicitly if a value is omitted for return statement. +Sun Aug 26 20:26:40 2001 Koji Arai + + * ext/readline/readline.c: restore terminal mode + even if readline() interrupted. + + * ext/readline/readline.c: returned string need to + be tainted. + + * ext/readline/readline.c: fixed memory leak. + + * ext/readline/readline.c: allow negative index. + + * ext/readline/readline.c: added Readline::HISTORY.size + same as Readline::HISTORY.length + + * ext/readline/readline.c: allow conditional parsing + of the ~/.inputrc file by `$if Ruby'. + + * ext/readline/extconf.rb: check whether the + libreadline has the variable `rl_completion_append_character' + (this feature was implemented from GNU readline 2.1). + Thu Aug 26 15:06:11 1999 Masaki Fukushima * gc.c (rb_gc): local variables may be placed beyond stack_end, so diff --git a/Makefile.in b/Makefile.in index fab157327b..ac2cf879f1 100644 --- a/Makefile.in +++ b/Makefile.in @@ -122,7 +122,7 @@ realclean: distclean @rm -f parse.c @rm -f lex.c -test: miniruby$(EXEEXT) +test: miniruby$(EXEEXT) rbconfig.rb @./miniruby$(EXEEXT) $(srcdir)/rubytest.rb rbconfig.rb: miniruby$(EXEEXT) $(srcdir)/mkconfig.rb config.status diff --git a/README b/README index 6a008e998e..bde22dff78 100644 --- a/README +++ b/README @@ -97,7 +97,7 @@ See the file COPYING. Feel free to send comments and bug reports to the author. Here is the author's latest mail address: - matz@zetabits.com + matz@netlab.jp ------------------------------------------------------- created at: Thu Aug 3 11:57:36 JST 1995 diff --git a/README.ja b/README.ja index be89ce1935..fc502dd440 100644 --- a/README.ja +++ b/README.ja @@ -145,7 +145,7 @@ COPYING.ja * 著者 -コメント,バグレポートその他は matz@zetabits.com まで. +コメント,バグレポートその他は matz@netlab.jp まで. ------------------------------------------------------- created at: Thu Aug 3 11:57:36 JST 1995 Local variables: diff --git a/class.c b/class.c index 43bb7b1c14..9f79a56973 100644 --- a/class.c +++ b/class.c @@ -291,7 +291,7 @@ void rb_include_module(klass, module) VALUE klass, module; { - VALUE p; + VALUE p, c; int changed = 0; rb_frozen_class_p(klass); @@ -312,22 +312,20 @@ rb_include_module(klass, module) } OBJ_INFECT(klass, module); + c = klass; while (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 && RCLASS(p)->m_tbl == RCLASS(module)->m_tbl) { - if (RCLASS(module)->super) { - rb_include_module(p, RCLASS(module)->super); - } - if (changed) rb_clear_cache(); - return; + goto skip; } } - RCLASS(klass)->super = include_class_new(module, RCLASS(klass)->super); - klass = RCLASS(klass)->super; - module = RCLASS(module)->super; + RCLASS(c)->super = include_class_new(module, RCLASS(c)->super); + c = RCLASS(c)->super; changed = 1; + skip: + module = RCLASS(module)->super; } if (changed) rb_clear_cache(); } diff --git a/dir.c b/dir.c index 3d3ca48fe4..f21051587e 100644 --- a/dir.c +++ b/dir.c @@ -75,6 +75,13 @@ char *strchr _((char*,char)); #define downcase(c) (nocase && ISUPPER(c) ? tolower(c) : (c)) +#ifndef CharNext /* defined as CharNext[AW] on Windows. */ +# if defined(DJGPP) +# define CharNext(p) ((p) + mblen(p, MB_CUR_MAX)) +# else +# define CharNext(p) ((p) + 1) +# endif +#endif #if defined DOSISH #define isdirsep(c) ((c) == '/' || (c) == '\\') static char * @@ -84,7 +91,7 @@ find_dirsep(s) while (*s) { if (isdirsep(*s)) return s; - s++; + s = CharNext(s); } return 0; } diff --git a/eval.c b/eval.c index aa97595cf1..0655cadc5e 100644 --- a/eval.c +++ b/eval.c @@ -7267,6 +7267,7 @@ rb_thread_save_context(th) { VALUE *pos; int len; + static VALUE tval; len = stack_length(&pos); th->stk_len = 0; @@ -7294,8 +7295,12 @@ rb_thread_save_context(th) th->tracing = tracing; th->errinfo = ruby_errinfo; th->last_status = rb_last_status; - th->last_line = rb_lastline_get(); - th->last_match = rb_backref_get(); + tval = rb_lastline_get(); + rb_lastline_set(th->last_line); + th->last_line = tval; + tval = rb_backref_get(); + rb_backref_set(th->last_match); + th->last_match = tval; th->safe = ruby_safe_level; th->file = ruby_sourcefile; @@ -7359,6 +7364,7 @@ rb_thread_restore_context(th, exit) VALUE v; static rb_thread_t tmp; static int ex; + static VALUE tval; if (!th->stk_ptr) rb_bug("unsaved context"); @@ -7395,8 +7401,12 @@ rb_thread_restore_context(th, exit) FLUSH_REGISTER_WINDOWS; MEMCPY(tmp->stk_pos, tmp->stk_ptr, VALUE, tmp->stk_len); + tval = rb_lastline_get(); rb_lastline_set(tmp->last_line); + tmp->last_line = tval; + tval = rb_backref_get(); rb_backref_set(tmp->last_match); + tmp->last_match = tval; longjmp(tmp->context, ex); } diff --git a/ext/digest/MANIFEST b/ext/digest/MANIFEST index bf7cfefce3..8d2d999f69 100644 --- a/ext/digest/MANIFEST +++ b/ext/digest/MANIFEST @@ -7,5 +7,28 @@ digest.txt.ja extconf.rb lib/md5.rb lib/sha1.rb +md5/MANIFEST +md5/extconf.rb +md5/md5.c +md5/md5.h +md5/md5init.c +rmd160/MANIFEST +rmd160/extconf.rb +rmd160/rmd160.c +rmd160/rmd160.h +rmd160/rmd160hl.c +rmd160/rmd160init.c +sha1/MANIFEST +sha1/extconf.rb +sha1/sha1.c +sha1/sha1.h +sha1/sha1hl.c +sha1/sha1init.c +sha2/MANIFEST +sha2/extconf.rb +sha2/sha2.c +sha2/sha2.h +sha2/sha2hl.c +sha2/sha2init.c test.rb test.sh diff --git a/file.c b/file.c index a54f1726ab..dbc9ac1c2a 100644 --- a/file.c +++ b/file.c @@ -2286,7 +2286,7 @@ extern VALUE rb_load_path; int rb_find_file_ext(filep, ext) VALUE *filep; - const char *const *ext; + const char * const *ext; { char *path, *e, *found; char *f = RSTRING(*filep)->ptr; diff --git a/lib/resolv.rb b/lib/resolv.rb index 16cf4b5c88..68b41c65bf 100644 --- a/lib/resolv.rb +++ b/lib/resolv.rb @@ -48,6 +48,7 @@ class Resolv def initialize(filename = DefaultFileName) @filename = filename @mutex = Mutex.new + @initialized = nil end def lazy_initialize @@ -106,6 +107,7 @@ class Resolv def initialize(config="/etc/resolv.conf") @mutex = Mutex.new @config = Config.new(config) + @initialized = nil end def lazy_initialize @@ -157,7 +159,7 @@ class Resolv end sender.send reply = reply_name = nil - timeout (tout) { reply, reply_name = q.pop } + timeout(tout) { reply, reply_name = q.pop } case reply.rcode when RCode::NoError return extract_resource(reply, reply_name, typeclass) @@ -385,6 +387,7 @@ class Resolv def initialize(filename="/etc/resolv.conf") @mutex = Mutex.new @filename = filename + @initialized = nil end def lazy_initialize diff --git a/numeric.c b/numeric.c index 51ff88d7a6..74e5654b64 100644 --- a/numeric.c +++ b/numeric.c @@ -216,21 +216,25 @@ flo_to_s(flt) char buf[24]; char *fmt = "%.10g"; double value = RFLOAT(flt)->value; - double d1, d2; + double avalue, d1, d2; if (isinf(value)) return rb_str_new2(value < 0 ? "-Infinity" : "Infinity"); else if(isnan(value)) return rb_str_new2("NaN"); - if (value < 1.0e-3) { - d1 = value; + avalue = fabs(value); + if (avalue == 0.0) { + fmt = "%.1f"; + } + else if (avalue < 1.0e-3) { + d1 = avalue; while (d1 < 1.0) d1 *= 10.0; d1 = modf(d1, &d2); if (d1 == 0) fmt = "%.1e"; } - else if (value >= 1.0e10) { - d1 = value; + else if (avalue >= 1.0e10) { + d1 = avalue; while (d1 > 10.0) d1 /= 10.0; d1 = modf(d1, &d2); if (d1 == 0) fmt = "%.1e"; diff --git a/process.c b/process.c index 261edb861d..c6c5d4b545 100644 --- a/process.c +++ b/process.c @@ -1112,17 +1112,19 @@ proc_setuid(obj, id) uid = NUM2INT(id); #if defined(HAVE_SETRESUID) && !defined(__CHECKER__) - setresuid(uid, -1, -1); + if (setresuid(uid, -1, -1) < 0) rb_sys_fail(0); #elif defined HAVE_SETREUID - setreuid(uid, -1); + if (setreuid(uid, -1) < 0) rb_sys_fail(0); #elif defined HAVE_SETRUID - setruid(uid); + if (setruid(uid) < 0) rb_sys_fail(0); #else { - if (geteuid() == uid) - setuid(uid); - else + if (geteuid() == uid) { + if (setuid(uid) < 0) rb_sys_fail(0); + } + else { rb_notimplement(); + } } #endif return INT2FIX(uid); @@ -1144,17 +1146,19 @@ proc_setgid(obj, id) gid = NUM2INT(id); #if defined(HAVE_SETRESGID) && !defined(__CHECKER__) - setresgid(gid, -1, -1); + if (setresgid(gid, -1, -1) < 0) rb_sys_fail(0); #elif defined HAVE_SETREGID - setregid(gid, -1); + if (setregid(gid, -1) < 0) rb_sys_fail(0); #elif defined HAS_SETRGID - setrgid((GIDTYPE)gid); + if (setrgid((GIDTYPE)gid) < 0) rb_sys_fail(0); #else { - if (getegid() == gid) - setgid(gid); - else + if (getegid() == gid) { + if (setgid(gid) < 0) rb_sys_fail(0); + } + else { rb_notimplement(); + } } #endif return INT2FIX(gid); @@ -1180,10 +1184,12 @@ proc_seteuid(obj, euid) if (seteuid(NUM2INT(euid)) < 0) rb_sys_fail(0); #else euid = NUM2INT(euid); - if (euid == getuid()) - setuid(euid); - else + if (euid == getuid()) { + if (setuid(euid) < 0) rb_sys_fail(0); + } + else { rb_notimplement(); + } #endif return euid; } @@ -1209,10 +1215,12 @@ proc_setegid(obj, egid) if (setegid(NUM2INT(egid)) < 0) rb_sys_fail(0); #else egid = NUM2INT(egid); - if (egid == getgid()) - setgid(egid); - else + if (egid == getgid()) { + if (setgid(egid) < 0) rb_sys_fail(0); + } + else { rb_notimplement(); + } #endif return egid; } diff --git a/ruby.1 b/ruby.1 index 30126d4e2e..6d6bebf1ae 100644 --- a/ruby.1 +++ b/ruby.1 @@ -1,4 +1,4 @@ -.\"Ruby is copyrighted by Yukihiro Matsumoto . +.\"Ruby is copyrighted by Yukihiro Matsumoto . .na .TH RUBY 1 "ruby 1.6" "2000-09-11" "Ruby Programmers Reference Guide" .SH NAME @@ -288,4 +288,4 @@ state messages during compiling scripts. You don't have to specify this switch, unless you are going to debug the Ruby interpreter. .PP .SH AUTHOR - Ruby is designed and implemented by Yukihiro Matsumoto . + Ruby is designed and implemented by Yukihiro Matsumoto . diff --git a/string.c b/string.c index 78126da285..00c139cb91 100644 --- a/string.c +++ b/string.c @@ -1967,11 +1967,11 @@ trnext(t) for (;;) { if (!t->gen) { if (t->p == t->pend) return -1; - t->now = *(USTR)t->p++; if (t->p < t->pend - 1 && *t->p == '\\') { t->p++; } - else if (t->p < t->pend - 1 && *t->p == '-') { + t->now = *(USTR)t->p++; + if (t->p < t->pend - 1 && *t->p == '-') { t->p++; if (t->p < t->pend) { if (t->now > *(USTR)t->p) { diff --git a/version.h b/version.h index f78f2c3105..44bf42e8ef 100644 --- a/version.h +++ b/version.h @@ -1,4 +1,4 @@ #define RUBY_VERSION "1.7.1" -#define RUBY_RELEASE_DATE "2001-09-05" +#define RUBY_RELEASE_DATE "2001-09-08" #define RUBY_VERSION_CODE 171 -#define RUBY_RELEASE_CODE 20010905 +#define RUBY_RELEASE_CODE 20010908 -- cgit v1.2.1