summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-03-19 03:20:24 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-03-19 03:20:24 +0000
commit1f904eed442f268d9f856aa25edbc7d7e906e6ae (patch)
treecbaec0fd2c96e995c07daf489fbb8f62782621c9
parentaa6fa0c75dff68dbe7a66b2fa1add778a050fb5d (diff)
* dir.c (glob_helper): replace lstat() by stat() to follow symlink
in the case like 'symlink/*'. * dir.c (glob_helper): gave warning too much. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1261 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--.cvsignore32
-rw-r--r--ChangeLog12
-rw-r--r--ToDo1
-rw-r--r--dir.c43
-rw-r--r--eval.c21
-rw-r--r--file.c10
-rw-r--r--gc.c24
-rw-r--r--intern.h4
-rw-r--r--ruby.h4
-rw-r--r--variable.c10
-rw-r--r--version.h4
-rw-r--r--win32/win32.h4
12 files changed, 106 insertions, 63 deletions
diff --git a/.cvsignore b/.cvsignore
index 4265e1f70f0..8876e1f015d 100644
--- a/.cvsignore
+++ b/.cvsignore
@@ -3,17 +3,49 @@
*.rej
*.sav
*~
+.ccmalloc
+.ppack
+COPYING.LIB
+ChangeLog.pre-alpha
+ChangeLog.pre1_1
Makefile
README.fat-patch
+README.v6
+a.rb
archive
+automake
+beos
config.cache
config.h
+config.h.in
config.log
config.status
configure
+foo.rb
miniruby
+miniruby.elhash
+miniruby.elhash2
+miniruby.orig2
+miniruby.plhash
+miniruby.plhash2
+modex.rb
+newdate.rb
newver.rb
parse.c
+parse.y.try
+pitest.rb
ppack
rbconfig.rb
+rename2.h
+repack
+riscos
+rubicon
ruby
+ruby-man.rd.gz
+rubyunit
+st.c.power
+this that
+tmp
+web
+y.output
+y.tab.c
diff --git a/ChangeLog b/ChangeLog
index 91b3ab7d705..0bf8f8d8ee0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Mon Mar 19 10:55:10 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * dir.c (glob_helper): replace lstat() by stat() to follow symlink
+ in the case like 'symlink/*'.
+
+ * dir.c (glob_helper): gave warning too much.
+
Sun Mar 18 08:58:18 2001 Wakou Aoyama <wakou@fsinet.or.jp>
* lib/net/cgi.rb: // === '' --> //.match('')
@@ -13,6 +20,11 @@ Sun Mar 18 08:58:18 2001 Wakou Aoyama <wakou@fsinet.or.jp>
* lib/net/cgi.rb: cgi#header(): bug fix.
thanks to IWATSUKI Hiroyuki <don@na.rim.or.jp>.
+Sat Mar 17 11:11:24 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * dir.c (glob_helper): * should follow symlink, whereas ** should
+ not follow.
+
Thu Mar 15 01:28:02 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
* dir.c (dir_s_chdir): block form of Dir.chdir. (RCR#U016).
diff --git a/ToDo b/ToDo
index 72826e6f543..4972fcdafb3 100644
--- a/ToDo
+++ b/ToDo
@@ -25,6 +25,7 @@ Language Spec.
* unify == and eql? again
* to_i returns nil if str contains no digit.
* raise exception by `` error
+* jar like combined library package.
Hacking Interpreter
diff --git a/dir.c b/dir.c
index 9e0b2cf28fc..289cb4c2cda 100644
--- a/dir.c
+++ b/dir.c
@@ -45,7 +45,7 @@
# include <ndir.h>
# endif
# if defined(NT) && defined(_MSC_VER)
-# include "missing/dir.h"
+# include "win32/dir.h"
# endif
#endif
@@ -62,7 +62,7 @@ char *strchr _((char*,char));
#include <ctype.h>
#ifndef HAVE_LSTAT
-#define lstat rb_sys_stat
+#define lstat stat
#endif
#define FNM_NOESCAPE 0x01
@@ -610,9 +610,10 @@ remove_backslashes(p)
# define S_ISDIR(m) ((m & S_IFMT) == S_IFDIR)
#endif
+#define GLOB_RECURSIVE 0x10
-void
-rb_glob_helper(path, flag, func, arg)
+static void
+glob_helper(path, flag, func, arg)
char *path;
int flag;
void (*func)();
@@ -623,10 +624,10 @@ rb_glob_helper(path, flag, func, arg)
if (!has_magic(path, 0)) {
remove_backslashes(path);
- if (rb_sys_stat(path, &st) == 0) {
+ if (stat(path, &st) == 0) {
(*func)(path, arg);
}
- else {
+ else if (!(flag & GLOB_RECURSIVE)) {
/* In case stat error is other than ENOENT and
we may want to know what is wrong. */
rb_sys_warning(path);
@@ -654,7 +655,7 @@ rb_glob_helper(path, flag, func, arg)
else dir = base;
magic = extract_elem(p);
- if (lstat(dir, &st) < 0) {
+ if (stat(dir, &st) < 0) {
rb_sys_warning(dir);
free(base);
break;
@@ -664,15 +665,15 @@ rb_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);
- rb_glob_helper(buf, flag, func, arg);
+ glob_helper(buf, flag|GLOB_RECURSIVE, func, arg);
free(buf);
}
- dirp = opendir(dir);
- if (dirp == NULL) {
- rb_sys_warning(dir);
- free(base);
- break;
- }
+ dirp = opendir(dir);
+ if (dirp == NULL) {
+ rb_sys_warning(dir);
+ free(base);
+ break;
+ }
}
else {
free(base);
@@ -690,15 +691,15 @@ rb_glob_helper(path, flag, func, arg)
if (strcmp(".", dp->d_name) == 0 || strcmp("..", dp->d_name) == 0)
continue;
buf = ALLOC_N(char, strlen(base)+NAMLEN(dp)+strlen(m)+6);
- sprintf(buf, "%s%s%s/", base, (BASE)?"/":"", dp->d_name);
+ sprintf(buf, "%s%s%s", base, (BASE)?"/":"", dp->d_name);
if (lstat(buf, &st) < 0) {
rb_sys_warning(buf);
continue;
}
if (S_ISDIR(st.st_mode)) {
- strcat(buf, "**");
+ strcat(buf, "/**");
strcat(buf, m);
- rb_glob_helper(buf, flag, func, arg);
+ glob_helper(buf, flag|GLOB_RECURSIVE, func, arg);
}
free(buf);
continue;
@@ -721,14 +722,14 @@ rb_glob_helper(path, flag, func, arg)
free(base);
free(magic);
while (link) {
- if (lstat(link->path, &st) == 0) {
+ 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);
sprintf(t, "%s%s", link->path, m);
- rb_glob_helper(t, flag, func, arg);
+ glob_helper(t, flag|GLOB_RECURSIVE, func, arg);
free(t);
}
tmp = link;
@@ -751,7 +752,7 @@ rb_glob(path, func, arg)
void (*func)();
VALUE arg;
{
- rb_glob_helper(path, FNM_PERIOD|FNM_PATHNAME, func, arg);
+ glob_helper(path, FNM_PERIOD|FNM_PATHNAME, func, arg);
}
void
@@ -760,7 +761,7 @@ rb_iglob(path, func, arg)
void (*func)();
VALUE arg;
{
- rb_glob_helper(path, FNM_PERIOD|FNM_PATHNAME|FNM_NOCASE, func, arg);
+ glob_helper(path, FNM_PERIOD|FNM_PATHNAME|FNM_NOCASE, func, arg);
}
static void
diff --git a/eval.c b/eval.c
index 93881002dee..46a361116b5 100644
--- a/eval.c
+++ b/eval.c
@@ -5956,13 +5956,13 @@ blk_mark(data)
{
while (data) {
rb_gc_mark_frame(&data->frame);
- rb_gc_mark(data->scope);
- rb_gc_mark(data->var);
- rb_gc_mark(data->body);
- rb_gc_mark(data->self);
- rb_gc_mark(data->dyna_vars);
- rb_gc_mark(data->klass);
- rb_gc_mark(data->tag);
+ rb_gc_mark((VALUE)data->scope);
+ rb_gc_mark((VALUE)data->var);
+ rb_gc_mark((VALUE)data->body);
+ rb_gc_mark((VALUE)data->self);
+ rb_gc_mark((VALUE)data->dyna_vars);
+ rb_gc_mark((VALUE)data->klass);
+ rb_gc_mark((VALUE)data->tag);
data = data->prev;
}
}
@@ -6456,7 +6456,7 @@ bm_mark(data)
rb_gc_mark(data->oklass);
rb_gc_mark(data->klass);
rb_gc_mark(data->recv);
- rb_gc_mark(data->body);
+ rb_gc_mark((VALUE)data->body);
}
static VALUE
@@ -6916,8 +6916,8 @@ thread_mark(th)
rb_gc_mark(th->klass);
rb_gc_mark(th->wrapper);
- rb_gc_mark(th->scope);
- rb_gc_mark(th->dyna_vars);
+ rb_gc_mark((VALUE)th->scope);
+ rb_gc_mark((VALUE)th->dyna_vars);
rb_gc_mark(th->errinfo);
rb_gc_mark(th->last_line);
rb_gc_mark(th->last_match);
@@ -7910,6 +7910,7 @@ rb_thread_abort_exc_set(thread, val)
\
th->status = THREAD_RUNNABLE;\
th->result = 0;\
+ th->flags = 0;\
\
th->stk_ptr = 0;\
th->stk_len = 0;\
diff --git a/file.c b/file.c
index c8970f787c1..d24f6297c14 100644
--- a/file.c
+++ b/file.c
@@ -67,7 +67,7 @@ char *strrchr _((const char*,const char));
#include <sys/stat.h>
#ifndef HAVE_LSTAT
-#define lstat rb_sys_stat
+#define lstat stat
#endif
VALUE rb_cFile;
@@ -313,7 +313,7 @@ rb_stat(file, st)
#if defined DJGPP
if (RSTRING(file)->len == 0) return -1;
#endif
- return rb_sys_stat(RSTRING(file)->ptr, st);
+ return stat(RSTRING(file)->ptr, st);
}
static VALUE
@@ -323,7 +323,7 @@ rb_file_s_stat(obj, fname)
struct stat st;
Check_SafeStr(fname);
- if (rb_sys_stat(RSTRING(fname)->ptr, &st) == -1) {
+ if (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 (rb_sys_stat(path, &st) < 0) return (-1);
+ if (stat(path, &st) < 0) return (-1);
if (euid == -1)
euid = geteuid ();
@@ -721,7 +721,7 @@ check3rdbyte(file, mode)
{
struct stat st;
- if (rb_sys_stat(file, &st) < 0) return Qfalse;
+ if (stat(file, &st) < 0) return Qfalse;
if (st.st_mode & mode) return Qtrue;
return Qfalse;
}
diff --git a/gc.c b/gc.c
index f60d950852f..f97899cefdf 100644
--- a/gc.c
+++ b/gc.c
@@ -420,7 +420,7 @@ rb_mark_hash(tbl)
void
rb_gc_mark_maybe(obj)
- void *obj;
+ VALUE obj;
{
if (is_pointer_to_heap(obj)) {
rb_gc_mark(obj);
@@ -429,7 +429,7 @@ rb_gc_mark_maybe(obj)
void
rb_gc_mark(ptr)
- void *ptr;
+ VALUE ptr;
{
register RVALUE *obj = RANY(ptr);
@@ -460,7 +460,7 @@ rb_gc_mark(ptr)
case NODE_MASGN:
case NODE_RESCUE:
case NODE_RESBODY:
- rb_gc_mark(obj->as.node.u2.node);
+ rb_gc_mark((VALUE)obj->as.node.u2.node);
/* fall through */
case NODE_BLOCK: /* 1,3 */
case NODE_ARRAY:
@@ -474,7 +474,7 @@ rb_gc_mark(ptr)
case NODE_CALL:
case NODE_DEFS:
case NODE_OP_ASGN1:
- rb_gc_mark(obj->as.node.u1.node);
+ rb_gc_mark((VALUE)obj->as.node.u1.node);
/* fall through */
case NODE_SUPER: /* 3 */
case NODE_FCALL:
@@ -497,7 +497,7 @@ rb_gc_mark(ptr)
case NODE_MATCH3:
case NODE_OP_ASGN_OR:
case NODE_OP_ASGN_AND:
- rb_gc_mark(obj->as.node.u1.node);
+ rb_gc_mark((VALUE)obj->as.node.u1.node);
/* fall through */
case NODE_METHOD: /* 2 */
case NODE_NOT:
@@ -531,7 +531,7 @@ rb_gc_mark(ptr)
case NODE_SCOPE: /* 2,3 */
case NODE_CLASS:
case NODE_BLOCK_PASS:
- rb_gc_mark(obj->as.node.u3.node);
+ rb_gc_mark((VALUE)obj->as.node.u3.node);
obj = RANY(obj->as.node.u2.node);
goto Top;
@@ -572,10 +572,10 @@ rb_gc_mark(ptr)
default:
if (is_pointer_to_heap(obj->as.node.u1.node)) {
- rb_gc_mark(obj->as.node.u1.node);
+ rb_gc_mark((VALUE)obj->as.node.u1.node);
}
if (is_pointer_to_heap(obj->as.node.u2.node)) {
- rb_gc_mark(obj->as.node.u2.node);
+ rb_gc_mark((VALUE)obj->as.node.u2.node);
}
if (is_pointer_to_heap(obj->as.node.u3.node)) {
obj = RANY(obj->as.node.u3.node);
@@ -689,7 +689,7 @@ gc_sweep()
p = heaps[i]; pend = p + HEAP_SLOTS;
while (p < pend) {
if (!(p->as.basic.flags&FL_MARK) && BUILTIN_TYPE(p) == T_NODE)
- rb_gc_mark(p);
+ rb_gc_mark((VALUE)p);
p++;
}
}
@@ -981,9 +981,9 @@ rb_gc()
}
}
}
- rb_gc_mark(ruby_class);
- rb_gc_mark(ruby_scope);
- rb_gc_mark(ruby_dyna_vars);
+ rb_gc_mark((VALUE)ruby_class);
+ rb_gc_mark((VALUE)ruby_scope);
+ rb_gc_mark((VALUE)ruby_dyna_vars);
if (finalizer_table) {
rb_mark_tbl(finalizer_table);
}
diff --git a/intern.h b/intern.h
index e3fec0967ee..1d0f38b60d9 100644
--- a/intern.h
+++ b/intern.h
@@ -182,8 +182,8 @@ char *rb_find_file _((char*));
void rb_gc_mark_locations _((VALUE*, VALUE*));
void rb_mark_tbl _((struct st_table*));
void rb_mark_hash _((struct st_table*));
-void rb_gc_mark_maybe _((void*));
-void rb_gc_mark _((void*));
+void rb_gc_mark_maybe _((VALUE));
+void rb_gc_mark _((VALUE));
void rb_gc_force_recycle _((VALUE));
void rb_gc _((void));
void rb_gc_call_finalizer_at_exit _((void));
diff --git a/ruby.h b/ruby.h
index ff7edf6c552..a9f9c115038 100644
--- a/ruby.h
+++ b/ruby.h
@@ -592,10 +592,6 @@ 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
diff --git a/variable.c b/variable.c
index 1c44c1c6d09..4f8ed302b76 100644
--- a/variable.c
+++ b/variable.c
@@ -266,7 +266,7 @@ rb_class2name(klass)
struct trace_var {
int removed;
void (*func)();
- void *data;
+ VALUE data;
struct trace_var *next;
};
@@ -362,7 +362,7 @@ val_setter(val, id, data, entry)
static void
val_marker(data)
- void *data;
+ VALUE data;
{
if (data) rb_gc_mark_maybe(data);
}
@@ -387,7 +387,7 @@ var_setter(val, id, var)
static void
var_marker(var)
- VALUE **var;
+ VALUE *var;
{
if (var) rb_gc_mark_maybe(*var);
}
@@ -514,7 +514,7 @@ rb_f_trace_var(argc, argv)
trace = ALLOC(struct trace_var);
trace->next = entry->trace;
trace->func = rb_trace_eval;
- trace->data = (void*)cmd;
+ trace->data = cmd;
trace->removed = 0;
entry->trace = trace;
@@ -576,7 +576,7 @@ rb_f_untrace_var(argc, argv)
}
else {
while (trace) {
- if (trace->data == (void*)cmd) {
+ if (trace->data == cmd) {
trace->removed = 1;
if (!entry->block_trace) remove_trace(entry);
return rb_ary_new3(1, cmd);
diff --git a/version.h b/version.h
index 8c22079a861..44eed6fe86b 100644
--- a/version.h
+++ b/version.h
@@ -1,4 +1,4 @@
#define RUBY_VERSION "1.7.0"
-#define RUBY_RELEASE_DATE "2001-03-16"
+#define RUBY_RELEASE_DATE "2001-03-19"
#define RUBY_VERSION_CODE 170
-#define RUBY_RELEASE_CODE 20010316
+#define RUBY_RELEASE_CODE 20010319
diff --git a/win32/win32.h b/win32/win32.h
index 1ffe7faa704..5df539ecbdc 100644
--- a/win32/win32.h
+++ b/win32/win32.h
@@ -179,8 +179,8 @@ extern "C++" {
#define pclose _pclose
#define strcasecmp _stricmp
#define strncasecmp _strnicmp
-#undef rb_sys_stat
-#define rb_sys_stat win32_stat
+#undef stat
+#define stat win32_stat
/* these are defined in nt.c */
#ifdef __MINGW32__