* io.c (read_all): fptr->f may be NULL, if IO is closed in the

signal handler.

* io.c (io_read): ditto.

* string.c (get_pat): remove 1.8.0 warning code.

* string.c (rb_str_match): extend warning until 1.8.2.

* string.c (rb_str_match2): ditto.

* class.c (class_instance_method_list): remove 1.8.0 warnings.
  method_list now recurs.  [ruby-dev:21816]

* class.c (rb_obj_singleton_methods): ditto.

* array.c (rb_ary_select): remove select with block.
  [ruby-dev:21824]

* hash.c (rb_hash_select): ditto.

* hash.c (env_select): ditto.

* re.c (match_select): ditto.

* struct.c (rb_struct_select): ditto.

* process.c (check_uid_switch): remove duplicated error messages.

* process.c (check_gid_switch): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4892 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2003-11-04 09:13:57 +00:00
Родитель 89d1dff343
Коммит a4934a42cb
13 изменённых файлов: 92 добавлений и 151 удалений

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

@ -1,3 +1,32 @@
Tue Nov 4 06:54:52 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* io.c (read_all): fptr->f may be NULL, if IO is closed in the
signal handler.
* io.c (io_read): ditto.
* string.c (get_pat): remove 1.8.0 warning code.
* string.c (rb_str_match): extend warning until 1.8.2.
* string.c (rb_str_match2): ditto.
* class.c (class_instance_method_list): remove 1.8.0 warnings.
method_list now recurs. [ruby-dev:21816]
* class.c (rb_obj_singleton_methods): ditto.
* array.c (rb_ary_select): remove select with block.
[ruby-dev:21824]
* hash.c (rb_hash_select): ditto.
* hash.c (env_select): ditto.
* re.c (match_select): ditto.
* struct.c (rb_struct_select): ditto.
Mon Nov 3 22:53:21 2003 Minero Aoki <aamine@loveruby.net>
* lib/racc/parser.rb: synchronize with Racc 1.4.4.
@ -7,6 +36,12 @@ Mon Nov 3 22:53:21 2003 Minero Aoki <aamine@loveruby.net>
* ext/racc/cparse/cparse.c (parse_main): should abort when
the length of LR state stack <=1, not ==0.
Mon Nov 3 08:50:47 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* process.c (check_uid_switch): remove duplicated error messages.
* process.c (check_gid_switch): ditto.
Sun Nov 2 02:28:33 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
* lib/webrick/ssl.rb: new option :SSLExtraChainCert.

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

@ -342,6 +342,7 @@ lib/test/unit/ui/fox/testrunner.rb
lib/test/unit/ui/gtk/testrunner.rb
lib/test/unit/ui/testrunnermediator.rb
lib/test/unit/ui/testrunnerutilities.rb
lib/test/unit/ui/tk/testrunner.rb
lib/test/unit/util/backtracefilter.rb
lib/test/unit/util/observable.rb
lib/test/unit/util/procwrapper.rb

11
array.c
Просмотреть файл

@ -254,8 +254,8 @@ rb_ary_initialize(argc, argv, ary)
if (rb_block_given_p()) {
long i;
if (argc > 1) {
rb_raise(rb_eArgError, "wrong number of arguments");
if (argc == 2) {
rb_warn("block supersedes default value argument");
}
for (i=0; i<len; i++) {
RARRAY(ary)->ptr[i] = rb_yield(LONG2NUM(i));
@ -655,8 +655,7 @@ rb_ary_indexes(argc, argv, ary)
VALUE new_ary;
long i;
rb_warn("Array#%s is deprecated; use Array#values_at",
rb_id2name(rb_frame_last_func()));
rb_warn("Array#%s is deprecated; use Array#values_at", rb_id2name(rb_frame_last_func()));
new_ary = rb_ary_new2(argc);
for (i=0; i<argc; i++) {
rb_ary_push(new_ary, rb_ary_aref(1, argv+i, ary));
@ -1270,10 +1269,6 @@ rb_ary_select(argc, argv, ary)
VALUE result;
long i;
if (!rb_block_given_p()) {
rb_warn("Array#select(index..) is deprecated; use Array#values_at");
return rb_ary_values_at(argc, argv, ary);
}
if (argc > 0) {
rb_raise(rb_eArgError, "wrong number arguments (%d for 0)", argc);
}

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

@ -539,12 +539,7 @@ class_instance_method_list(argc, argv, mod, func)
st_table *list;
if (argc == 0) {
#if RUBY_VERSION_CODE < 181
rb_warn("%s: parameter will default to 'true' as of 1.8.1", rb_id2name(rb_frame_last_func()));
recur = Qfalse;
#else
recur = Qtrue;
#endif
}
else {
VALUE r;
@ -613,11 +608,7 @@ rb_obj_singleton_methods(argc, argv, obj)
rb_scan_args(argc, argv, "01", &recur);
if (argc == 0) {
#if RUBY_VERSION_CODE < 181
rb_warn("singleton_methods: parameter will default to 'true' as of 1.8.1");
#else
recur = Qtrue;
#endif
}
klass = CLASS_OF(obj);
list = st_init_numtable();

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

@ -480,6 +480,7 @@ name_err_initialize(argc, argv, self)
VALUE self;
{
VALUE name = (argc > 1) ? argv[--argc] : Qnil;
exc_initialize(argc, argv, self);
rb_iv_set(self, "name", name);
return self;

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

@ -4727,7 +4727,6 @@ rb_method_missing(argc, argv, obj)
id = SYM2ID(argv[0]);
switch (TYPE(obj)) {
case T_NIL:
desc = "nil";

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

@ -99,7 +99,7 @@ rb_file_path(obj)
fptr = RFILE(rb_io_taint_check(obj))->fptr;
if (!fptr->path) return Qnil;
return rb_str_new2(fptr->path);
return rb_tainted_str_new2(fptr->path);
}
static VALUE

10
hash.c
Просмотреть файл

@ -529,12 +529,6 @@ rb_hash_select(argc, argv, hash)
{
VALUE result;
if (!rb_block_given_p()) {
#if RUBY_VERSION_CODE < 181
rb_warn("Hash#select(key..) is deprecated; use Hash#values_at");
#endif
return rb_hash_values_at(argc, argv, hash);
}
if (argc > 0) {
rb_raise(rb_eArgError, "wrong number arguments(%d for 0)", argc);
}
@ -1454,10 +1448,6 @@ env_select(argc, argv)
VALUE result;
char **env;
if (!rb_block_given_p()) {
rb_warn("ENV.select(index..) is deprecated; use ENV.values_at");
return env_values_at(argc, argv);
}
if (argc > 0) {
rb_raise(rb_eArgError, "wrong number arguments(%d for 0)", argc);
}

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

@ -790,6 +790,7 @@ read_all(fptr, siz, str)
n = rb_io_fread(RSTRING(str)->ptr+bytes, siz-bytes, fptr->f);
if (pos > 0 && n == 0 && bytes == 0) {
rb_str_resize(str,0);
if (!fptr->f) return Qnil;
if (feof(fptr->f)) return Qnil;
if (!ferror(fptr->f)) return str;
rb_sys_fail(fptr->path);
@ -843,6 +844,7 @@ io_read(argc, argv, io)
n = rb_io_fread(RSTRING(str)->ptr, len, fptr->f);
if (n == 0) {
rb_str_resize(str,0);
if (!fptr->f) return Qnil;
if (feof(fptr->f)) return Qnil;
if (len > 0) rb_sys_fail(fptr->path);
}

138
process.c
Просмотреть файл

@ -1238,17 +1238,31 @@ proc_setpriority(obj, which, who, prio)
}
static int under_uid_switch = 0;
static void
check_uid_switch()
{
rb_secure(2);
if (under_uid_switch) {
rb_raise(rb_eRuntimeError, "can't handle UID during evaluating the block given to the Process::UID.switch method");
}
}
static int under_gid_switch = 0;
static void
check_gid_switch()
{
rb_secure(2);
if (under_gid_switch) {
rb_raise(rb_eRuntimeError, "can't handle GID during evaluating the block given to the Process::UID.switch method");
}
}
static VALUE
p_sys_setuid(obj, id)
VALUE obj, id;
{
#if defined HAVE_SETUID
rb_secure(2);
if (under_uid_switch) {
rb_raise(rb_eRuntimeError, "can't handle UID during evaluating the block given to the Process::UID.switch method");
}
check_uid_switch();
if (setuid(NUM2INT(id)) != 0) rb_sys_fail(0);
#else
rb_notimplement();
@ -1261,10 +1275,7 @@ p_sys_setruid(obj, id)
VALUE obj, id;
{
#if defined HAVE_SETRUID
rb_secure(2);
if (under_uid_switch) {
rb_raise(rb_eRuntimeError, "can't handle UID during evaluating the block given to the Process::UID.switch method");
}
check_uid_switch();
if (setruid(NUM2INT(id)) != 0) rb_sys_fail(0);
#else
rb_notimplement();
@ -1277,10 +1288,7 @@ p_sys_seteuid(obj, id)
VALUE obj, id;
{
#if defined HAVE_SETEUID
rb_secure(2);
if (under_uid_switch) {
rb_raise(rb_eRuntimeError, "can't handle UID during evaluating the block given to the Process::UID.switch method");
}
check_uid_switch();
if (seteuid(NUM2INT(id)) != 0) rb_sys_fail(0);
#else
rb_notimplement();
@ -1293,10 +1301,7 @@ p_sys_setreuid(obj, rid, eid)
VALUE obj, rid, eid;
{
#if defined HAVE_SETREUID
rb_secure(2);
if (under_uid_switch) {
rb_raise(rb_eRuntimeError, "can't handle UID during evaluating the block given to the Process::UID.switch method");
}
check_uid_switch();
if (setreuid(NUM2INT(rid),NUM2INT(eid)) != 0) rb_sys_fail(0);
#else
rb_notimplement();
@ -1309,10 +1314,7 @@ p_sys_setresuid(obj, rid, eid, sid)
VALUE obj, rid, eid, sid;
{
#if defined HAVE_SETRESUID
rb_secure(2);
if (under_uid_switch) {
rb_raise(rb_eRuntimeError, "can't handle UID during evaluating the block given to the Process::UID.switch method");
}
check_uid_switch();
if (setresuid(NUM2INT(rid),NUM2INT(eid),NUM2INT(sid)) != 0) rb_sys_fail(0);
#else
rb_notimplement();
@ -1334,10 +1336,7 @@ proc_setuid(obj, id)
{
int uid = NUM2INT(id);
rb_secure(2);
if (under_uid_switch) {
rb_raise(rb_eRuntimeError, "can't handle UID during evaluating the block given to the Process::UID.switch method");
}
check_uid_switch();
#if defined(HAVE_SETRESUID) && !defined(__CHECKER__)
if (setresuid(uid, -1, -1) < 0) rb_sys_fail(0);
#elif defined HAVE_SETREUID
@ -1368,10 +1367,7 @@ p_uid_change_privilege(obj, id)
extern int errno;
int uid;
rb_secure(2);
if (under_uid_switch) {
rb_raise(rb_eRuntimeError, "can't handle UID during evaluating the block given to the Process::UID.switch method");
}
check_uid_switch();
uid = NUM2INT(id);
@ -1509,10 +1505,7 @@ p_sys_setgid(obj, id)
VALUE obj, id;
{
#if defined HAVE_SETGID
rb_secure(2);
if (under_gid_switch) {
rb_raise(rb_eRuntimeError, "can't handle GID during evaluating the block given to the Process::GID.switch method");
}
check_gid_switch();
if (setgid(NUM2INT(id)) != 0) rb_sys_fail(0);
#else
rb_notimplement();
@ -1525,10 +1518,7 @@ p_sys_setrgid(obj, id)
VALUE obj, id;
{
#if defined HAVE_SETRGID
rb_secure(2);
if (under_gid_switch) {
rb_raise(rb_eRuntimeError, "can't handle GID during evaluating the block given to the Process::GID.switch method");
}
check_gid_switch();
if (setrgid(NUM2INT(id)) != 0) rb_sys_fail(0);
#else
rb_notimplement();
@ -1541,10 +1531,7 @@ p_sys_setegid(obj, id)
VALUE obj, id;
{
#if defined HAVE_SETEGID
rb_secure(2);
if (under_gid_switch) {
rb_raise(rb_eRuntimeError, "can't handle GID during evaluating the block given to the Process::GID.switch method");
}
check_gid_switch();
if (setegid(NUM2INT(id)) != 0) rb_sys_fail(0);
#else
rb_notimplement();
@ -1557,10 +1544,7 @@ p_sys_setregid(obj, rid, eid)
VALUE obj, rid, eid;
{
#if defined HAVE_SETREGID
rb_secure(2);
if (under_gid_switch) {
rb_raise(rb_eRuntimeError, "can't handle GID during evaluating the block given to the Process::GID.switch method");
}
check_gid_switch();
if (setregid(NUM2INT(rid),NUM2INT(eid)) != 0) rb_sys_fail(0);
#else
rb_notimplement();
@ -1573,10 +1557,7 @@ p_sys_setresgid(obj, rid, eid, sid)
VALUE obj, rid, eid, sid;
{
#if defined HAVE_SETRESGID
rb_secure(2);
if (under_gid_switch) {
rb_raise(rb_eRuntimeError, "can't handle GID during evaluating the block given to the Process::GID.switch method");
}
check_gid_switch();
if (setresgid(NUM2INT(rid),NUM2INT(eid),NUM2INT(sid)) != 0) rb_sys_fail(0);
#else
rb_notimplement();
@ -1614,10 +1595,7 @@ proc_setgid(obj, id)
{
int gid = NUM2INT(id);
rb_secure(2);
if (under_gid_switch) {
rb_raise(rb_eRuntimeError, "can't handle GID during evaluating the block given to the Process::GID.switch method");
}
check_gid_switch();
#if defined(HAVE_SETRESGID) && !defined(__CHECKER__)
if (setresgid(gid, -1, -1) < 0) rb_sys_fail(0);
#elif defined HAVE_SETREGID
@ -1763,10 +1741,7 @@ p_gid_change_privilege(obj, id)
extern int errno;
int gid;
rb_secure(2);
if (under_gid_switch) {
rb_raise(rb_eRuntimeError, "can't handle GID during evaluating the block given to the Process::GID.switch method");
}
check_gid_switch();
gid = NUM2INT(id);
@ -1912,10 +1887,7 @@ static VALUE
proc_seteuid(obj, euid)
VALUE obj, euid;
{
rb_secure(2);
if (under_uid_switch) {
rb_raise(rb_eRuntimeError, "can't handle UID during evaluating the block given to the Process::UID.switch method");
}
check_uid_switch();
#if defined(HAVE_SETRESUID) && !defined(__CHECKER__)
if (setresuid(-1, NUM2INT(euid), -1) < 0) rb_sys_fail(0);
#elif defined HAVE_SETREUID
@ -1942,10 +1914,7 @@ rb_seteuid_core(euid)
{
int uid;
rb_secure(2);
if (under_uid_switch) {
rb_raise(rb_eRuntimeError, "can't handle UID during evaluating the block given to the Process::UID.switch method");
}
check_uid_switch();
uid = getuid();
@ -1994,10 +1963,8 @@ static VALUE
proc_setegid(obj, egid)
VALUE obj, egid;
{
rb_secure(2);
if (under_gid_switch) {
rb_raise(rb_eRuntimeError, "can't handle GID during evaluating the block given to the Process::GID.switch method");
}
check_gid_switch();
#if defined(HAVE_SETRESGID) && !defined(__CHECKER__)
if (setresgid(-1, NUM2INT(egid), -1) < 0) rb_sys_fail(0);
#elif defined HAVE_SETREGID
@ -2024,10 +1991,7 @@ rb_setegid_core(egid)
{
int gid;
rb_secure(2);
if (under_gid_switch) {
rb_raise(rb_eRuntimeError, "can't handle GID during evaluating the block given to the Process::GID.switch method");
}
check_gid_switch();
gid = getgid();
@ -2081,10 +2045,7 @@ p_uid_exchange(obj)
{
int uid, euid;
rb_secure(2);
if (under_uid_switch) {
rb_raise(rb_eRuntimeError, "can't handle UID during evaluating the block given to the Process::UID.switch method");
}
check_uid_switch();
uid = getuid();
euid = geteuid();
@ -2119,10 +2080,7 @@ p_gid_exchange(obj)
{
int gid, egid;
rb_secure(2);
if (under_gid_switch) {
rb_raise(rb_eRuntimeError, "can't handle GID during evaluating the block given to the Process::GID.switch method");
}
check_gid_switch();
gid = getgid();
egid = getegid();
@ -2166,10 +2124,7 @@ p_uid_switch(obj)
extern int errno;
int uid, euid;
rb_secure(2);
if (under_uid_switch) {
rb_raise(rb_eRuntimeError, "can't handle UID during evaluating the block given to the Process::UID.switch method");
}
check_uid_switch();
uid = getuid();
euid = geteuid();
@ -2211,10 +2166,7 @@ p_uid_switch(obj)
extern int errno;
int uid, euid;
rb_secure(2);
if (under_uid_switch) {
rb_raise(rb_eRuntimeError, "can't handle UID during evaluating the block given to the Process::UID.switch method");
}
check_uid_switch();
uid = getuid();
euid = geteuid();
@ -2259,10 +2211,7 @@ p_gid_switch(obj)
extern int errno;
int gid, egid;
rb_secure(2);
if (under_gid_switch) {
rb_raise(rb_eRuntimeError, "can't handle GID during evaluating the block given to the Process::GID.switch method");
}
check_gid_switch();
gid = getgid();
egid = getegid();
@ -2303,10 +2252,7 @@ p_gid_switch(obj)
extern int errno;
int gid, egid;
rb_secure(2);
if (under_gid_switch) {
rb_raise(rb_eRuntimeError, "can't handle GID during evaluating the block given to the Process::GID.switch method");
}
check_gid_switch();
gid = getgid();
egid = getegid();

4
re.c
Просмотреть файл

@ -992,10 +992,6 @@ match_select(argc, argv, match)
VALUE *argv;
VALUE match;
{
if (!rb_block_given_p()) {
rb_warn("MatchData#select(index..) is deprecated; use MatchData#values_at");
return match_values_at(argc, argv, match);
}
if (argc > 0) {
rb_raise(rb_eArgError, "wrong number arguments(%d for 0)", argc);
}

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

@ -1056,19 +1056,14 @@ rb_str_match(x, y)
long start;
switch (TYPE(y)) {
case T_REGEXP:
return rb_reg_match(y, x);
case T_STRING:
#if RUBY_VERSION_CODE < 181
#if RUBY_VERSION_CODE < 182
rb_warn("string =~ string will be obsolete; use explicit regexp");
#endif
reg = rb_reg_regcomp(y);
start = rb_reg_search(reg, x, 0, 0);
if (start == -1) {
return Qnil;
}
return INT2NUM(start);
y = rb_reg_regcomp(y);
/* fall through */
case T_REGEXP:
return rb_reg_match(y, x);
default:
return rb_funcall(y, rb_intern("=~"), 1, x);
@ -1080,7 +1075,7 @@ rb_str_match2(str)
VALUE str;
{
StringValue(str);
#if RUBY_VERSION_CODE < 181
#if RUBY_VERSION_CODE < 182
rb_warn("~string will be obsolete; use explicit regexp");
#endif
return rb_reg_match2(rb_reg_regcomp(rb_reg_quote(str)));
@ -1501,13 +1496,7 @@ get_pat(pat, quote)
}
if (quote) {
val = rb_reg_quote(pat);
#if RUBY_VERSION_CODE < 181
if (val != pat && rb_str_cmp(val, pat) != 0) {
rb_warn("string pattern instead of regexp; metacharacters no longer effective");
}
#endif
pat = val;
pat = rb_reg_quote(pat);
}
return rb_reg_regcomp(pat);

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

@ -544,10 +544,6 @@ rb_struct_select(argc, argv, s)
VALUE result;
long i;
if (!rb_block_given_p()) {
rb_warn("Struct#select(index..) is deprecated; use Struct#values_at");
return rb_struct_values_at(argc, argv, s);
}
if (argc > 0) {
rb_raise(rb_eArgError, "wrong number arguments(%d for 0)", argc);
}