зеркало из https://github.com/github/ruby.git
* gc.c (id2ref): sometimes confused symbol and reference.
* dir.c (glob_helper): breaks loop after calling recusive glob_helper; all wild cards should be consumed; no need for further match. * dir.c (dir_s_glob): gives warning if no match found. * object.c (sym_inspect): did allocate extra byte space. * marshal.c (shortlen): shortlen should return number of bytes written. * eval.c (ev_const_defined): need not to check if cbase->nd_class is rb_cObject. * eval.c (ev_const_get): ditto. * time.c (time_zone): return "UTC" for UTC time objects. * eval.c (THREAD_ALLOC): flags should be initialized. * signal.c (rb_f_kill): should use FIX2INT, not FIX2UINT. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1267 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
98e25a542a
Коммит
9910feef4f
38
ChangeLog
38
ChangeLog
|
@ -6,12 +6,50 @@ Wed Mar 21 08:05:35 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
|
|||
|
||||
* win32/win32.c: ditto.
|
||||
|
||||
Wed Mar 21 01:26:14 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* gc.c (id2ref): sometimes confused symbol and reference.
|
||||
|
||||
Tue Mar 20 23:09:33 2001 WATANABE Hirofumi <eban@ruby-lang.org>
|
||||
|
||||
* win32/win32.c (win32_stat): UNC support.
|
||||
|
||||
* dir.c (extract_path): fix "./*" problem.
|
||||
|
||||
Tue Mar 20 15:10:00 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* dir.c (glob_helper): breaks loop after calling recusive
|
||||
glob_helper; all wild cards should be consumed; no need for
|
||||
further match.
|
||||
|
||||
* dir.c (dir_s_glob): gives warning if no match found.
|
||||
|
||||
Tue Mar 20 14:13:45 Koji Arai <JCA02266@nifty.ne.jp>
|
||||
|
||||
* object.c (sym_inspect): did allocate extra byte space.
|
||||
|
||||
Mon Mar 19 19:14:47 2001 Guy Decoux <decoux@moulon.inra.fr>
|
||||
|
||||
* marshal.c (shortlen): shortlen should return number of bytes
|
||||
written.
|
||||
|
||||
Mon Mar 19 16:52:23 2001 K.Kosako <kosako@sofnec.co.jp>
|
||||
|
||||
* eval.c (ev_const_defined): need not to check if cbase->nd_class
|
||||
is rb_cObject.
|
||||
|
||||
* eval.c (ev_const_get): ditto.
|
||||
|
||||
Mon Mar 19 17:11:20 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* time.c (time_zone): return "UTC" for UTC time objects.
|
||||
|
||||
Mon Mar 19 16:27:32 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* eval.c (THREAD_ALLOC): flags should be initialized.
|
||||
|
||||
* signal.c (rb_f_kill): should use FIX2INT, not FIX2UINT.
|
||||
|
||||
Mon Mar 19 10:55:10 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* dir.c (glob_helper): replace lstat() by stat() to follow symlink
|
||||
|
|
58
dir.c
58
dir.c
|
@ -62,7 +62,7 @@ char *strchr _((char*,char));
|
|||
#include <ctype.h>
|
||||
|
||||
#ifndef HAVE_LSTAT
|
||||
#define lstat stat
|
||||
#define lstat rb_sys_stat
|
||||
#endif
|
||||
|
||||
#define FNM_NOESCAPE 0x01
|
||||
|
@ -610,8 +610,6 @@ remove_backslashes(p)
|
|||
# define S_ISDIR(m) ((m & S_IFMT) == S_IFDIR)
|
||||
#endif
|
||||
|
||||
#define GLOB_RECURSIVE 0x10
|
||||
|
||||
static void
|
||||
glob_helper(path, flag, func, arg)
|
||||
char *path;
|
||||
|
@ -624,10 +622,10 @@ glob_helper(path, flag, func, arg)
|
|||
|
||||
if (!has_magic(path, 0)) {
|
||||
remove_backslashes(path);
|
||||
if (stat(path, &st) == 0) {
|
||||
if (rb_sys_stat(path, &st) == 0) {
|
||||
(*func)(path, arg);
|
||||
}
|
||||
else if (!(flag & GLOB_RECURSIVE)) {
|
||||
else if (errno != ENOENT) {
|
||||
/* In case stat error is other than ENOENT and
|
||||
we may want to know what is wrong. */
|
||||
rb_sys_warning(path);
|
||||
|
@ -655,8 +653,8 @@ glob_helper(path, flag, func, arg)
|
|||
else dir = base;
|
||||
|
||||
magic = extract_elem(p);
|
||||
if (stat(dir, &st) < 0) {
|
||||
rb_sys_warning(dir);
|
||||
if (rb_sys_stat(dir, &st) < 0) {
|
||||
if (errno != ENOENT) rb_sys_warning(dir);
|
||||
free(base);
|
||||
break;
|
||||
}
|
||||
|
@ -665,7 +663,7 @@ glob_helper(path, flag, func, arg)
|
|||
recursive = 1;
|
||||
buf = ALLOC_N(char, strlen(base)+strlen(m)+3);
|
||||
sprintf(buf, "%s%s", base, *base ? m : m+1);
|
||||
glob_helper(buf, flag|GLOB_RECURSIVE, func, arg);
|
||||
glob_helper(buf, flag, func, arg);
|
||||
free(buf);
|
||||
}
|
||||
dirp = opendir(dir);
|
||||
|
@ -693,13 +691,13 @@ glob_helper(path, flag, func, arg)
|
|||
buf = ALLOC_N(char, strlen(base)+NAMLEN(dp)+strlen(m)+6);
|
||||
sprintf(buf, "%s%s%s", base, (BASE)?"/":"", dp->d_name);
|
||||
if (lstat(buf, &st) < 0) {
|
||||
rb_sys_warning(buf);
|
||||
if (errno != ENOENT) rb_sys_warning(buf);
|
||||
continue;
|
||||
}
|
||||
if (S_ISDIR(st.st_mode)) {
|
||||
strcat(buf, "/**");
|
||||
strcat(buf, m);
|
||||
glob_helper(buf, flag|GLOB_RECURSIVE, func, arg);
|
||||
glob_helper(buf, flag, func, arg);
|
||||
}
|
||||
free(buf);
|
||||
continue;
|
||||
|
@ -721,25 +719,28 @@ glob_helper(path, flag, func, arg)
|
|||
closedir(dirp);
|
||||
free(base);
|
||||
free(magic);
|
||||
while (link) {
|
||||
if (stat(link->path, &st) == 0) {
|
||||
if (S_ISDIR(st.st_mode)) {
|
||||
int len = strlen(link->path);
|
||||
int mlen = strlen(m);
|
||||
char *t = ALLOC_N(char, len+mlen+1);
|
||||
if (link) {
|
||||
while (link) {
|
||||
if (rb_sys_stat(link->path, &st) == 0) {
|
||||
if (S_ISDIR(st.st_mode)) {
|
||||
int len = strlen(link->path);
|
||||
int mlen = strlen(m);
|
||||
char *t = ALLOC_N(char, len+mlen+1);
|
||||
|
||||
sprintf(t, "%s%s", link->path, m);
|
||||
glob_helper(t, flag|GLOB_RECURSIVE, func, arg);
|
||||
free(t);
|
||||
sprintf(t, "%s%s", link->path, m);
|
||||
glob_helper(t, flag, func, arg);
|
||||
free(t);
|
||||
}
|
||||
tmp = link;
|
||||
link = link->next;
|
||||
free(tmp->path);
|
||||
free(tmp);
|
||||
}
|
||||
else {
|
||||
rb_sys_warning(link->path);
|
||||
}
|
||||
tmp = link;
|
||||
link = link->next;
|
||||
free(tmp->path);
|
||||
free(tmp);
|
||||
}
|
||||
else {
|
||||
rb_sys_warning(link->path);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
p = m;
|
||||
|
@ -756,7 +757,7 @@ rb_glob(path, func, arg)
|
|||
}
|
||||
|
||||
void
|
||||
rb_iglob(path, func, arg)
|
||||
rb_globi(path, func, arg)
|
||||
char *path;
|
||||
void (*func)();
|
||||
VALUE arg;
|
||||
|
@ -886,6 +887,9 @@ dir_s_glob(dir, str)
|
|||
}
|
||||
if (buf != buffer)
|
||||
free(buf);
|
||||
if (ary && RARRAY(ary)->len == 0) {
|
||||
rb_warning("no matches found: %s", RSTRING(str)->ptr);
|
||||
}
|
||||
return ary;
|
||||
}
|
||||
|
||||
|
|
8
eval.c
8
eval.c
|
@ -1428,7 +1428,7 @@ ev_const_defined(cref, id, self)
|
|||
{
|
||||
NODE *cbase = cref;
|
||||
|
||||
while (cbase && cbase->nd_clss != rb_cObject) {
|
||||
while (cbase) {
|
||||
struct RClass *klass = RCLASS(cbase->nd_clss);
|
||||
|
||||
if (NIL_P(klass)) return rb_const_defined(CLASS_OF(self), id);
|
||||
|
@ -1449,7 +1449,7 @@ ev_const_get(cref, id, self)
|
|||
NODE *cbase = cref;
|
||||
VALUE result;
|
||||
|
||||
while (cbase && cbase->nd_clss != rb_cObject) {
|
||||
while (cbase) {
|
||||
struct RClass *klass = RCLASS(cbase->nd_clss);
|
||||
|
||||
if (NIL_P(klass)) return rb_const_get(CLASS_OF(self), id);
|
||||
|
@ -1467,7 +1467,7 @@ rb_mod_nesting()
|
|||
NODE *cbase = RNODE(ruby_frame->cbase);
|
||||
VALUE ary = rb_ary_new();
|
||||
|
||||
while (cbase && cbase->nd_clss != rb_cObject) {
|
||||
while (cbase) {
|
||||
rb_ary_push(ary, cbase->nd_clss);
|
||||
cbase = cbase->nd_next;
|
||||
}
|
||||
|
@ -1480,7 +1480,7 @@ rb_mod_s_constants()
|
|||
NODE *cbase = RNODE(ruby_frame->cbase);
|
||||
VALUE ary = rb_ary_new();
|
||||
|
||||
while (cbase && cbase->nd_clss != rb_cObject) {
|
||||
while (cbase) {
|
||||
rb_mod_const_at(cbase->nd_clss, ary);
|
||||
cbase = cbase->nd_next;
|
||||
}
|
||||
|
|
|
@ -1828,7 +1828,7 @@ sock_s_getservbyaname(argc, argv)
|
|||
|
||||
port = strtoul(s, &end, 0);
|
||||
if (*end != '\0') {
|
||||
rb_raise(rb_eSocket, "no such servce %s/%s", s, proto);
|
||||
rb_raise(rb_eSocket, "no such service %s/%s", s, proto);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
12
file.c
12
file.c
|
@ -313,7 +313,7 @@ rb_stat(file, st)
|
|||
#if defined DJGPP
|
||||
if (RSTRING(file)->len == 0) return -1;
|
||||
#endif
|
||||
return stat(RSTRING(file)->ptr, st);
|
||||
return rb_sys_stat(RSTRING(file)->ptr, st);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
|
@ -323,7 +323,7 @@ rb_file_s_stat(obj, fname)
|
|||
struct stat st;
|
||||
|
||||
Check_SafeStr(fname);
|
||||
if (stat(RSTRING(fname)->ptr, &st) == -1) {
|
||||
if (rb_sys_stat(RSTRING(fname)->ptr, &st) == -1) {
|
||||
rb_sys_fail(RSTRING(fname)->ptr);
|
||||
}
|
||||
return stat_new(&st);
|
||||
|
@ -419,7 +419,7 @@ eaccess(path, mode)
|
|||
struct stat st;
|
||||
static int euid = -1;
|
||||
|
||||
if (stat(path, &st) < 0) return (-1);
|
||||
if (rb_sys_stat(path, &st) < 0) return (-1);
|
||||
|
||||
if (euid == -1)
|
||||
euid = geteuid ();
|
||||
|
@ -721,7 +721,7 @@ check3rdbyte(file, mode)
|
|||
{
|
||||
struct stat st;
|
||||
|
||||
if (stat(file, &st) < 0) return Qfalse;
|
||||
if (rb_sys_stat(file, &st) < 0) return Qfalse;
|
||||
if (st.st_mode & mode) return Qtrue;
|
||||
return Qfalse;
|
||||
}
|
||||
|
@ -2115,7 +2115,7 @@ path_check_1(path)
|
|||
return path_check_1(buf);
|
||||
}
|
||||
for (;;) {
|
||||
if (stat(path, &st) == 0 && (st.st_mode & 002)) {
|
||||
if (rb_sys_stat(path, &st) == 0 && (st.st_mode & 002)) {
|
||||
if (p) *p = '/';
|
||||
return 0;
|
||||
}
|
||||
|
@ -2234,7 +2234,7 @@ rb_find_file(file)
|
|||
}
|
||||
|
||||
path = dln_find_file(file, path);
|
||||
if (path && stat(path, &st) == 0) {
|
||||
if (path && rb_sys_stat(path, &st) == 0) {
|
||||
return path;
|
||||
}
|
||||
return 0;
|
||||
|
|
8
gc.c
8
gc.c
|
@ -42,7 +42,7 @@ void rb_io_fptr_finalize _((struct OpenFile*));
|
|||
# if defined(HAVE_ALLOCA_H)
|
||||
# include <alloca.h>
|
||||
# elif !defined(alloca)
|
||||
char *alloca();
|
||||
void *alloca();
|
||||
# endif
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
|
@ -1294,11 +1294,13 @@ id2ref(obj, id)
|
|||
|
||||
rb_secure(4);
|
||||
p0 = ptr = NUM2UINT(id);
|
||||
if (FIXNUM_P(ptr)) return (VALUE)ptr;
|
||||
if (SYMBOL_P(ptr)) return (VALUE)ptr;
|
||||
if (ptr == Qtrue) return Qtrue;
|
||||
if (ptr == Qfalse) return Qfalse;
|
||||
if (ptr == Qnil) return Qnil;
|
||||
if (FIXNUM_P(ptr)) return (VALUE)ptr;
|
||||
if (SYMBOL_P(ptr) && rb_id2name(SYM2ID((VALUE)ptr)) != 0) {
|
||||
return (VALUE)ptr;
|
||||
}
|
||||
|
||||
ptr = id ^ FIXNUM_FLAG; /* unset FIXNUM_FLAG */
|
||||
if (!is_pointer_to_heap(ptr)) {
|
||||
|
|
|
@ -535,7 +535,7 @@ Commands
|
|||
cat[ch] <an Exception> set catchpoint to an exception
|
||||
b[reak] list breakpoints
|
||||
cat[ch] show catchpoint
|
||||
del[ele][ nnn] delete some or all breakpoints
|
||||
del[ete][ nnn] delete some or all breakpoints
|
||||
disp[lay] <expression> add expression into display expression list
|
||||
undisp[lay][ nnn] delete one particular or all display expressions
|
||||
c[ont] run until program ends or hit breakpoint
|
||||
|
|
|
@ -32,7 +32,7 @@ module Find
|
|||
d.close
|
||||
end
|
||||
end
|
||||
rescue Errno::ENOENT
|
||||
rescue Errno::ENOENT, Errno::EACCES
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -46,7 +46,7 @@ shortlen(len, ds)
|
|||
num = SHORTDN(num);
|
||||
offset++;
|
||||
}
|
||||
return len*sizeof(BDIGIT)/sizeof(short) - offset;
|
||||
return (len - 1)*sizeof(BDIGIT)/sizeof(short) + offset;
|
||||
}
|
||||
#define SHORTLEN(x) shortlen((x),d)
|
||||
#endif
|
||||
|
|
2
object.c
2
object.c
|
@ -512,7 +512,7 @@ sym_inspect(sym)
|
|||
char *name;
|
||||
|
||||
name = rb_id2name(SYM2ID(sym));
|
||||
str = rb_str_new(0, strlen(name)+2);
|
||||
str = rb_str_new(0, strlen(name)+1);
|
||||
RSTRING(str)->ptr[0] = ':';
|
||||
strcpy(RSTRING(str)->ptr+1, name);
|
||||
return str;
|
||||
|
|
4
ruby.h
4
ruby.h
|
@ -592,6 +592,10 @@ rb_special_const_p(VALUE obj)
|
|||
static char *dln_libs_to_be_linked[] = { EXTLIB, 0 };
|
||||
#endif
|
||||
|
||||
#ifndef rb_sys_stat
|
||||
#define rb_sys_stat stat
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus)
|
||||
} /* extern "C" { */
|
||||
#endif
|
||||
|
|
2
signal.c
2
signal.c
|
@ -252,7 +252,7 @@ rb_f_kill(argc, argv)
|
|||
else {
|
||||
for (i=1; i<argc; i++) {
|
||||
Check_Type(argv[i], T_FIXNUM);
|
||||
if (kill(FIX2UINT(argv[i]), sig) < 0)
|
||||
if (kill(FIX2INT(argv[i]), sig) < 0)
|
||||
rb_sys_fail(0);
|
||||
}
|
||||
}
|
||||
|
|
3
time.c
3
time.c
|
@ -841,6 +841,9 @@ time_zone(time)
|
|||
time_get_tm(time, tobj->gmt);
|
||||
}
|
||||
|
||||
if (tobj->gmt == 1) {
|
||||
return rb_str_new2("UTC");
|
||||
}
|
||||
#if defined(HAVE_TM_ZONE)
|
||||
return rb_str_new2(tobj->tm.tm_zone);
|
||||
#elif defined(HAVE_TZNAME) && defined(HAVE_DAYLIGHT)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#define RUBY_VERSION "1.7.0"
|
||||
#define RUBY_RELEASE_DATE "2001-03-20"
|
||||
#define RUBY_RELEASE_DATE "2001-03-21"
|
||||
#define RUBY_VERSION_CODE 170
|
||||
#define RUBY_RELEASE_CODE 20010320
|
||||
#define RUBY_RELEASE_CODE 20010321
|
||||
|
|
Загрузка…
Ссылка в новой задаче