Hi,

At Tue, 15 Aug 2006 18:00:24 +0900,
Ryan Davis wrote in [ruby-core:08622]:
> I just found it...

Thank you.

> I can patch the rdoc options processing code to make it work  
> regardless, but I'd like some eyeballs on the difference between the  
> two. Is this a documentation problem or an implementation problem?

I think it is a bug.


* file.c (rb_stat_[rRwWxX]): check for super user.


Index: file.c =================================================================== RCS file: /cvs/ruby/src/ruby/file.c,v retrieving revision 1.169.2.47 diff -p -U 2 -r1.169.2.47 file.c --- file.c 20 Jul 2006 07:04:17 -0000 1.169.2.47 +++ file.c 16 Aug 2006 02:40:20 -0000 @@ -850,4 +850,8 @@ group_member(gid) #endif +#if defined(S_IXGRP) && !defined(_WIN32) && !defined(__CYGWIN__) +#define USE_GETEUID 1 +#endif + #ifndef HAVE_EACCESS int @@ -856,5 +860,5 @@ eaccess(path, mode) int mode; { -#if defined(S_IXGRP) && !defined(_WIN32) && !defined(__CYGWIN__) +#ifdef USE_GETEUID struct stat st; int euid; @@ -3745,4 +3749,7 @@ rb_stat_r(obj) struct stat *st = get_stat(obj); +#ifdef USE_GETEUID + if (geteuid() == 0) return Qtrue; +#endif #ifdef S_IRUSR if (rb_stat_owned(obj)) @@ -3778,4 +3785,7 @@ rb_stat_R(obj) struct stat *st = get_stat(obj); +#ifdef USE_GETEUID + if (getuid() == 0) return Qtrue; +#endif #ifdef S_IRUSR if (rb_stat_rowned(obj)) @@ -3809,4 +3819,7 @@ rb_stat_w(obj) struct stat *st = get_stat(obj); +#ifdef USE_GETEUID + if (geteuid() == 0) return Qtrue; +#endif #ifdef S_IWUSR if (rb_stat_owned(obj)) @@ -3840,4 +3853,7 @@ rb_stat_W(obj) struct stat *st = get_stat(obj); +#ifdef USE_GETEUID + if (getuid() == 0) return Qtrue; +#endif #ifdef S_IWUSR if (rb_stat_rowned(obj)) @@ -3873,4 +3889,9 @@ rb_stat_x(obj) struct stat *st = get_stat(obj); +#ifdef USE_GETEUID + if (geteuid() == 0) { + return st->st_mode & S_IXUGO ? Qtrue : Qfalse; + } +#endif #ifdef S_IXUSR if (rb_stat_owned(obj)) @@ -3902,4 +3923,9 @@ rb_stat_X(obj) struct stat *st = get_stat(obj); +#ifdef USE_GETEUID + if (getuid() == 0) { + return st->st_mode & S_IXUGO ? Qtrue : Qfalse; + } +#endif #ifdef S_IXUSR if (rb_stat_rowned(obj))
-- Nobu Nakada