summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog13
-rw-r--r--error.c4
-rw-r--r--eval.c3
-rw-r--r--gc.c10
-rw-r--r--intern.h8
-rw-r--r--lib/cgi/session.rb2
-rw-r--r--lib/cgi/session/pstore.rb3
-rw-r--r--lib/date.rb2
-rw-r--r--lib/debug.rb4
-rw-r--r--ruby.c8
10 files changed, 37 insertions, 20 deletions
diff --git a/ChangeLog b/ChangeLog
index cf453f58a7..d289c8c90b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,20 @@
+Fri Jul 23 16:40:25 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * gc.c (define_final): should not disclose NODE* to Ruby world.
+ [ruby-dev:23957]
+
Fri Jul 23 08:52:22 2004 Shugo Maeda <shugo@ruby-lang.org>
* lib/net/imap.rb (disconnected?): new method.
+Thu Jul 22 16:41:54 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * lib/cgi/session.rb (CGI::Session::FileStore#update): sets the
+ permission of the session data file to 0600.
+
+ * lib/cgi/session/pstore.rb (CGI::Session::Pstore#initialize):
+ ditto.
+
Mon Jul 19 00:53:46 2004 GOTOU Yuuzou <gotoyuzo@notwork.org>
* lib/webrick/httpservlet/cgihandler.rb
diff --git a/error.c b/error.c
index dab9475f6f..d6f5485933 100644
--- a/error.c
+++ b/error.c
@@ -1147,14 +1147,14 @@ rb_sys_warning(fmt, va_alist)
void
rb_load_fail(path)
- char *path;
+ const char *path;
{
rb_loaderror("%s -- %s", strerror(errno), path);
}
void
rb_error_frozen(what)
- char *what;
+ const char *what;
{
rb_raise(rb_eTypeError, "can't modify frozen %s", what);
}
diff --git a/eval.c b/eval.c
index 57c5752eb0..eebe1a2c61 100644
--- a/eval.c
+++ b/eval.c
@@ -10971,10 +10971,13 @@ rb_thread_sleep(sec)
void
rb_thread_sleep_forever()
{
+ int thr_critical = rb_thread_critical;
if (curr_thread == curr_thread->next ||
curr_thread->status == THREAD_TO_KILL) {
+ rb_thread_critical = Qtrue;
TRAP_BEG;
pause();
+ rb_thread_critical = thr_critical;
TRAP_END;
return;
}
diff --git a/gc.c b/gc.c
index bcdf693307..13a123fc16 100644
--- a/gc.c
+++ b/gc.c
@@ -1685,8 +1685,6 @@ undefine_final(os, obj)
return obj;
}
-#define NODE_FINAL NODE_LIT
-
/*
* call-seq:
* ObjectSpace.define_finalizer(obj, aProc=proc())
@@ -1715,7 +1713,7 @@ define_final(argc, argv, os)
need_call_final = 1;
FL_SET(obj, FL_FINALIZE);
- block = (VALUE)rb_node_newnode(NODE_FINAL, block, ruby_safe_level, 0);
+ block = rb_ary_new3(2, INT2FIX(ruby_safe_level), block);
if (!finalizer_table) {
finalizer_table = st_init_numtable();
@@ -1768,9 +1766,9 @@ run_final(obj)
}
if (finalizer_table && st_delete(finalizer_table, (st_data_t*)&obj, &table)) {
for (i=0; i<RARRAY(table)->len; i++) {
- NODE *final = (NODE *)RARRAY(table)->ptr[i];
- args[0] = final->nd_lit;
- args[2] = final->nd_nth;
+ VALUE final = RARRAY(table)->ptr[i];
+ args[0] = FIX2INT(RARRAY(final)->ptr[0]);
+ args[2] = RARRAY(final)->ptr[1];
rb_protect((VALUE(*)_((VALUE)))run_single_final, (VALUE)args, &status);
}
}
diff --git a/intern.h b/intern.h
index 88a5b8cb86..77f60e1004 100644
--- a/intern.h
+++ b/intern.h
@@ -143,8 +143,8 @@ NORETURN(void rb_name_error __((ID, const char*, ...)));
NORETURN(void rb_invalid_str _((const char*, const char*)));
void rb_compile_error __((const char*, ...));
void rb_compile_error_append __((const char*, ...));
-NORETURN(void rb_load_fail _((char*)));
-NORETURN(void rb_error_frozen _((char*)));
+NORETURN(void rb_load_fail _((const char*)));
+NORETURN(void rb_error_frozen _((const char*)));
void rb_check_frozen _((VALUE));
/* eval.c */
RUBY_EXTERN struct RNode *ruby_current_node;
@@ -381,8 +381,8 @@ const char* rb_get_kcode _((void));
/* ruby.c */
RUBY_EXTERN VALUE rb_argv;
RUBY_EXTERN VALUE rb_argv0;
-void rb_load_file _((char*));
-void ruby_script _((char*));
+void rb_load_file _((const char*));
+void ruby_script _((const char*));
void ruby_prog_init _((void));
void ruby_set_argv _((int, char**));
void ruby_process_options _((int, char**));
diff --git a/lib/cgi/session.rb b/lib/cgi/session.rb
index a44de7cb81..0bc10d013f 100644
--- a/lib/cgi/session.rb
+++ b/lib/cgi/session.rb
@@ -395,7 +395,7 @@ class CGI
def update
return unless @hash
begin
- f = File.open(@path, 'w')
+ f = File.open(@path, File::CREAT|File::TRUNC|File::RDWR, 0600)
f.flock File::LOCK_EX
for k,v in @hash
f.printf "%s=%s\n", CGI::escape(k), CGI::escape(String(v))
diff --git a/lib/cgi/session/pstore.rb b/lib/cgi/session/pstore.rb
index 8f4beb978a..f46dd57392 100644
--- a/lib/cgi/session/pstore.rb
+++ b/lib/cgi/session/pstore.rb
@@ -70,6 +70,9 @@ class CGI
@hash = {}
end
@p = ::PStore.new(path)
+ @p.transaction do |p|
+ File.chmod(0600, p.path)
+ end
end
# Restore session state from the session's PStore file.
diff --git a/lib/date.rb b/lib/date.rb
index b8c15a420a..3e3e33de7a 100644
--- a/lib/date.rb
+++ b/lib/date.rb
@@ -711,7 +711,7 @@ class Date
alias_method :__#{id.to_i}__, :#{id.to_s}
private :__#{id.to_i}__
def #{id.to_s}(*args, &block)
- if @__#{id.to_i}__
+ if defined? @__#{id.to_i}__
@__#{id.to_i}__
elsif ! self.frozen?
@__#{id.to_i}__ ||= __#{id.to_i}__(*args, &block)
diff --git a/lib/debug.rb b/lib/debug.rb
index 0a105abab8..1b12188a76 100644
--- a/lib/debug.rb
+++ b/lib/debug.rb
@@ -189,10 +189,10 @@ class Context
def debug_variable_info(input, binding)
case input
- when /^\s*g(?:lobal)?$/
+ when /^\s*g(?:lobal)?\s*$/
var_list(global_variables, binding)
- when /^\s*l(?:ocal)?$/
+ when /^\s*l(?:ocal)?\s*$/
var_list(eval("local_variables", binding), binding)
when /^\s*i(?:nstance)?\s+/
diff --git a/ruby.c b/ruby.c
index e733bf1b6a..52faf02f76 100644
--- a/ruby.c
+++ b/ruby.c
@@ -61,7 +61,7 @@ extern int ruby_yydebug;
char *ruby_inplace_mode = Qfalse;
static void load_stdin _((void));
-static void load_file _((char *, int));
+static void load_file _((const char *, int));
static void forbid_setid _((const char *));
static VALUE do_loop = Qfalse, do_print = Qfalse;
@@ -801,7 +801,7 @@ extern int ruby__end__seen;
static void
load_file(fname, script)
- char *fname;
+ const char *fname;
int script;
{
extern VALUE rb_stdin;
@@ -924,7 +924,7 @@ load_file(fname, script)
void
rb_load_file(fname)
- char *fname;
+ const char *fname;
{
load_file(fname, 0);
}
@@ -1010,7 +1010,7 @@ set_arg0(val, id)
void
ruby_script(name)
- char *name;
+ const char *name;
{
if (name) {
rb_progname = rb_tainted_str_new2(name);