From 9ee0cafbfe7a94a7b6a9d0e7f2dbf7c7fd229757 Mon Sep 17 00:00:00 2001 From: matz Date: Tue, 13 Jun 2000 09:42:40 +0000 Subject: 2000-06-13 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@750 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 12 ++++++++++++ ToDo | 3 ++- io.c | 28 ++++++++++++++++++++++++---- process.c | 20 +++++++++++++++++--- re.c | 20 ++++++++++++-------- version.h | 4 ++-- 6 files changed, 69 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index f7a8f9bccc..bfd1db5058 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +Tue Jun 13 11:46:17 2000 Yukihiro Matsumoto + + * process.c (proc_setsid): try implement it using setpgrp() and + ioctl(fd, TIOCNOTTY, NULL). + + * re.c (rb_reg_prepare_re): magic variable $= should affect regex + pattern match. + + * time.c (make_time_t): use tm.tm_gmtoff if possible. + + * time.c (time_zone): use tm.tm_zone if available. + Mon Jun 12 23:41:54 2000 WATANABE Hirofumi * configure.in (daylight): avoid GCC optimization. diff --git a/ToDo b/ToDo index a85e6b8c50..27d436df24 100644 --- a/ToDo +++ b/ToDo @@ -44,7 +44,8 @@ Hacking Interpreter * scrambled script, or script filter * setuid ruby * performance tune for in-block (dynamic) local variables. -* generational GC ?? (is it possible?) +* generational GC ? +* give warnings to assign magic variables. Standard Libraries diff --git a/io.c b/io.c index 61120908b3..f56ed79f73 100644 --- a/io.c +++ b/io.c @@ -498,6 +498,10 @@ io_fread(ptr, len, f) c = getc(f); TRAP_END; if (c == EOF) { + if (ferror(f)) { + if (errno == EINTR) continue; + rb_sys_fail(0); + } *ptr = '\0'; break; } @@ -624,7 +628,10 @@ rb_io_gets_internal(argc, argv, io) c = getc(f); TRAP_END; if (c == EOF) { - if (ferror(f) && errno == EINTR) continue; + if (ferror(f)) { + if (errno == EINTR) continue; + rb_sys_fail(fptr->path); + } break; } if ((*bp++ = c) == newline) break; @@ -711,7 +718,10 @@ rb_io_gets(io) c = getc(f); TRAP_END; if (c == EOF) { - if (ferror(f) && errno == EINTR) continue; + if (ferror(f)) { + if (errno == EINTR) continue; + rb_sys_fail(fptr->path); + } break; } if ((*bp++ = c) == '\n') break; @@ -865,7 +875,13 @@ rb_io_each_byte(io) TRAP_BEG; c = getc(f); TRAP_END; - if (c == EOF) break; + if (c == EOF) { + if (ferror(f)) { + if (errno == EINTR) continue; + rb_sys_fail(fptr->path); + } + break; + } rb_yield(INT2FIX(c & 0xff)); } if (ferror(f)) rb_sys_fail(fptr->path); @@ -884,13 +900,17 @@ rb_io_getc(io) rb_io_check_readable(fptr); f = fptr->f; + retry: READ_CHECK(f); TRAP_BEG; c = getc(f); TRAP_END; if (c == EOF) { - if (ferror(f)) rb_sys_fail(fptr->path); + if (ferror(f)) { + if (errno == EINTR) goto retry; + rb_sys_fail(fptr->path); + } return Qnil; } return INT2FIX(c & 0xff); diff --git a/process.c b/process.c index bd078a3c8d..8077de5495 100644 --- a/process.c +++ b/process.c @@ -826,13 +826,29 @@ proc_setpgid(obj, pid, pgrp) static VALUE proc_setsid() { -#ifdef HAVE_SETSID +#if defined(HAVE_SETSID) int pid; rb_secure(2); pid = setsid(); if (pid < 0) rb_sys_fail(0); return INT2FIX(pid); +#elif defined(HAVE_SETPGRP) && defined(TIOCNOTTY) + pid_t sid; + +#if defined(SETPGRP_VOID) + sid = setpgrp(); +#else + sid = setpgrp(0, getpid()); +#endif + if (sid == -1) return -1; + + if ((fd = open("/dev/tty", O_RDWR)) >= 0) { + ioctl(fd, TIOCNOTTY, NULL); + close(fd); + } + return sid; +} #else rb_notimplement(); #endif @@ -1025,9 +1041,7 @@ Init_process() #endif #endif -#if !defined(NT) rb_define_singleton_method(rb_mProcess, "fork", rb_f_fork, 0); -#endif rb_define_singleton_method(rb_mProcess, "exit!", rb_f_exit_bang, -1); rb_define_module_function(rb_mProcess, "kill", rb_f_kill, -1); #ifndef NT diff --git a/re.c b/re.c index ca1972add6..5559ce0a0f 100644 --- a/re.c +++ b/re.c @@ -520,16 +520,20 @@ rb_reg_prepare_re(re) VALUE re; { int need_recompile = 0; + int state; rb_reg_check(re); - /* case-flag not set for the object */ - if (!(RREGEXP(re)->ptr->options & RE_OPTION_IGNORECASE)) { - int state = FL_TEST(re, REG_CASESTATE); - - if ((ruby_ignorecase || state) && !(ruby_ignorecase && state)) { - RBASIC(re)->flags ^= REG_CASESTATE; - need_recompile = 1; - } + state = FL_TEST(re, REG_CASESTATE); + /* ignorecase status */ + if (ruby_ignorecase && !state) { + FL_SET(re, REG_CASESTATE); + RREGEXP(re)->ptr->options |= RE_OPTION_IGNORECASE; + need_recompile = 1; + } + if (!ruby_ignorecase && state) { + FL_UNSET(re, REG_CASESTATE); + RREGEXP(re)->ptr->options &= ~RE_OPTION_IGNORECASE; + need_recompile = 1; } if (!FL_TEST(re, KCODE_FIXED) && diff --git a/version.h b/version.h index 51e086cb95..e1ec541064 100644 --- a/version.h +++ b/version.h @@ -1,4 +1,4 @@ #define RUBY_VERSION "1.5.4" -#define RUBY_RELEASE_DATE "2000-06-12" +#define RUBY_RELEASE_DATE "2000-06-13" #define RUBY_VERSION_CODE 154 -#define RUBY_RELEASE_CODE 20000612 +#define RUBY_RELEASE_CODE 20000613 -- cgit v1.2.3