git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1002 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2000-10-13 09:01:58 +00:00
Родитель 12d1bc6bd5
Коммит 52f90f6566
6 изменённых файлов: 48 добавлений и 15 удалений

Просмотреть файл

@ -12,6 +12,26 @@ Thu Oct 12 01:23:38 2000 Wakou Aoyama <wakou@fsinet.or.jp>
* lib/cgi.rb: bug fix: CGI::html(): PRETTY option didn't work.
Thu Oct 12 00:03:02 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
* object.c (sym_inspect): should adjust string length.
* struct.c (rb_struct_to_s): ditto.
* struct.c (rb_struct_inspect): ditto.
Wed Oct 11 22:15:47 2000 Katsuyuki Komatsu <komatsu@sarion.co.jp>
* eval.c (rb_thread_inspect): should adjust string length.
* object.c (rb_any_to_s): ditto.
* object.c (rb_obj_inspect): ditto.
Wed Oct 11 18:13:50 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (rb_thread_start_0): should check insecure exit.
Wed Oct 11 14:29:51 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
* lib/net/protocol.rb: 2nd arg for ProtocolError#initialize is optional.

31
eval.c
Просмотреть файл

@ -139,7 +139,7 @@ rb_secure(level)
int level;
{
if (level <= ruby_safe_level) {
rb_raise(rb_eSecurityError, "Insecure operation `%s' for level %d",
rb_raise(rb_eSecurityError, "Insecure operation `%s' at level %d",
rb_id2name(ruby_frame->last_func), ruby_safe_level);
}
}
@ -535,7 +535,7 @@ struct BLOCK {
int iter;
int vmode;
int flags;
struct RVarmap *d_vars;
struct RVarmap *dyna_vars;
VALUE orig_thread;
struct BLOCK *prev;
};
@ -560,7 +560,7 @@ static struct BLOCK *ruby_block;
_block.iter = ruby_iter->iter; \
_block.vmode = scope_vmode; \
_block.flags = BLOCK_D_SCOPE; \
_block.d_vars = ruby_dyna_vars; \
_block.dyna_vars = ruby_dyna_vars; \
ruby_block = &_block;
#define POP_BLOCK() \
@ -637,6 +637,7 @@ rb_dvar_ref(id)
struct RVarmap *vars = ruby_dyna_vars;
while (vars) {
if (TYPE(vars) != T_VARMAP) abort();
if (vars->id == id) {
return vars->val;
}
@ -663,6 +664,7 @@ dvar_asgn_internal(id, value, curr)
struct RVarmap *vars = ruby_dyna_vars;
while (vars) {
if (TYPE(vars) != T_VARMAP) abort();
if (curr && vars->id == 0) {
n++;
if (n == 2) break;
@ -3419,11 +3421,11 @@ rb_yield_0(val, self, klass, acheck)
ruby_block = block->prev;
if (block->flags & BLOCK_D_SCOPE) {
/* put place holder for dynamic (in-block) local variables */
ruby_dyna_vars = new_dvar(0, 0, block->d_vars);
ruby_dyna_vars = new_dvar(0, 0, block->dyna_vars);
}
else {
/* FOR does not introduce new scope */
ruby_dyna_vars = block->d_vars;
ruby_dyna_vars = block->dyna_vars;
}
ruby_class = klass?klass:block->klass;
if (!self) self = block->self;
@ -4598,7 +4600,7 @@ eval(self, src, scope, file, line)
volatile VALUE result = Qnil;
struct SCOPE * volatile old_scope;
struct BLOCK * volatile old_block;
struct RVarmap * volatile old_d_vars;
struct RVarmap * volatile old_dyna_vars;
int volatile old_vmode;
struct FRAME frame;
char *filesave = ruby_sourcefile;
@ -4626,8 +4628,8 @@ eval(self, src, scope, file, line)
ruby_scope = data->scope;
old_block = ruby_block;
ruby_block = data->prev;
old_d_vars = ruby_dyna_vars;
ruby_dyna_vars = data->d_vars;
old_dyna_vars = ruby_dyna_vars;
ruby_dyna_vars = data->dyna_vars;
old_vmode = scope_vmode;
scope_vmode = data->vmode;
@ -4668,7 +4670,7 @@ eval(self, src, scope, file, line)
scope_dup(old_scope);
ruby_scope = old_scope;
ruby_block = old_block;
ruby_dyna_vars = old_d_vars;
ruby_dyna_vars = old_dyna_vars;
data->vmode = scope_vmode; /* write back visibility mode */
scope_vmode = old_vmode;
}
@ -5779,7 +5781,7 @@ blk_mark(data)
rb_gc_mark(data->var);
rb_gc_mark(data->body);
rb_gc_mark(data->self);
rb_gc_mark(data->d_vars);
rb_gc_mark(data->dyna_vars);
rb_gc_mark(data->klass);
data = data->prev;
}
@ -5901,7 +5903,7 @@ rb_f_binding(self)
data->prev = 0;
}
for (vars = data->d_vars; vars; vars = vars->next) {
for (vars = data->dyna_vars; vars; vars = vars->next) {
if (FL_TEST(vars, DVAR_DONT_RECYCLE)) break;
FL_SET(vars, DVAR_DONT_RECYCLE);
}
@ -5983,7 +5985,7 @@ proc_new(klass)
}
data->flags |= BLOCK_DYNAMIC;
for (vars = data->d_vars; vars; vars = vars->next) {
for (vars = data->dyna_vars; vars; vars = vars->next) {
if (FL_TEST(vars, DVAR_DONT_RECYCLE)) break;
FL_SET(vars, DVAR_DONT_RECYCLE);
}
@ -7805,6 +7807,10 @@ rb_thread_start_0(fn, arg, th)
rb_thread_cleanup();
}
else if (rb_obj_is_kind_of(ruby_errinfo, rb_eSystemExit)) {
if (ruby_safe_level >= 4) {
rb_raise(rb_eSecurityError, "Insecure exit at level %d",
ruby_safe_level);
}
/* delegate exception to main_thread */
rb_thread_raise(1, &ruby_errinfo, main_thread);
}
@ -8181,6 +8187,7 @@ rb_thread_inspect(thread)
}
str = rb_str_new(0, strlen(cname)+6+16+9+1); /* 6:tags 16:addr 9:status 1:nul */
sprintf(RSTRING(str)->ptr, "#<%s:0x%lx %s>", cname, thread, status);
RSTRING(str)->len = strlen(RSTRING(str)->ptr);
OBJ_INFECT(str, thread);
return str;

2
file.c
Просмотреть файл

@ -1260,7 +1260,7 @@ rb_file_s_expand_path(argc, argv)
}
#endif
else if (!isdirsep(*s)) {
if (argc == 2) {
if (!NIL_P(dname)) {
dname = rb_file_s_expand_path(1, &dname);
if (OBJ_TAINTED(dname)) tainted = 1;
strcpy(buf, RSTRING(dname)->ptr);

Просмотреть файл

@ -134,6 +134,7 @@ rb_any_to_s(obj)
str = rb_str_new(0, strlen(cname)+6+16+1); /* 6:tags 16:addr 1:eos */
sprintf(RSTRING(str)->ptr, "#<%s:0x%lx>", cname, obj);
RSTRING(str)->len = strlen(RSTRING(str)->ptr);
if (OBJ_TAINTED(obj)) OBJ_TAINT(str);
return str;
@ -199,10 +200,12 @@ rb_obj_inspect(obj)
if (rb_inspecting_p(obj)) {
str = rb_str_new(0, strlen(c)+8+16+1); /* 8:tags 16:addr 1:eos */
sprintf(RSTRING(str)->ptr, "#<%s:0x%lx ...>", c, obj);
RSTRING(str)->len = strlen(RSTRING(str)->ptr);
return str;
}
str = rb_str_new(0, strlen(c)+4+16+1); /* 4:tags 16:addr 1:eos */
sprintf(RSTRING(str)->ptr, "-<%s:0x%lx ", c, obj);
RSTRING(str)->len = strlen(RSTRING(str)->ptr);
return rb_protect_inspect(inspect_obj, obj, str);
}
return rb_funcall(obj, rb_intern("to_s"), 0, 0);
@ -498,6 +501,7 @@ sym_inspect(sym)
str = rb_str_new(0, strlen(name)+2);
name = rb_id2name(SYM2ID(sym));
sprintf(RSTRING(str)->ptr, ":%s", name);
RSTRING(str)->len = strlen(RSTRING(str)->ptr);
return str;
}

Просмотреть файл

@ -341,6 +341,7 @@ rb_struct_to_s(s)
VALUE str = rb_str_new(0, strlen(cname) + 4);
sprintf(RSTRING(str)->ptr, "#<%s>", cname);
RSTRING(str)->len = strlen(RSTRING(str)->ptr);
return str;
}
@ -389,6 +390,7 @@ rb_struct_inspect(s)
VALUE str = rb_str_new(0, strlen(cname) + 8);
sprintf(RSTRING(str)->ptr, "#<%s:...>", cname);
RSTRING(str)->len = strlen(RSTRING(str)->ptr);
return str;
}
return rb_protect_inspect(inspect_struct, s, 0);

Просмотреть файл

@ -1,4 +1,4 @@
#define RUBY_VERSION "1.6.2"
#define RUBY_RELEASE_DATE "2000-10-11"
#define RUBY_RELEASE_DATE "2000-10-12"
#define RUBY_VERSION_CODE 162
#define RUBY_RELEASE_CODE 20001011
#define RUBY_RELEASE_CODE 20001012