List Info

Thread: invalid test in "sudo make install-doc"?




invalid test in "sudo make install-doc"?
user name
2006-11-15 12:59:47
 <nobu <at> ruby-lang.org> writes:
> > 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.


Hi

I think it is a bug, too. But it doesn't affect root only.
File.stat doesn't
honour secondary groups either when determining the
readability of a file:

% id
uid=500(thomi) gid=100(users) groups=100(users),8(www)
% touch foobar; chmod 660 foobar;
% ruby -e 'p [File.stat("foobar").readable?,
File.readable?("foobar")]'; sudo
chgrp users foobar; ruby -e 'p
[File.stat("foobar").readable?,
File.readable?("foobar"), "primary group is
honoured"]'; sudo chown nobody:www
foobar; ruby -e 'p [File.stat("foobar").readable?,
File.readable?("foobar"),
"secondary group not honoured"]'
)
[true, true]
[true, true, "primary group is honoured"]
[false, true, "secondary group not honoured"]

Regards, Thomas



invalid test in "sudo make install-doc"?
user name
2006-11-15 14:45:55
Hi,

At Wed, 15 Nov 2006 21:59:47 +0900,
Thomas Werschlein wrote in [ruby-core:09546]:
> I think it is a bug, too. But it doesn't affect root
only. File.stat doesn't
> honour secondary groups either when determining the
readability of a file:

Thank you.


* file.c (test_grpowned, rb_stat_grpowned): should honour
  supplementary group IDs.


Index: file.c
============================================================
=======
RCS file: /cvs/ruby/src/ruby/file.c,v
retrieving revision 1.169.2.53
diff -p -U 2 -r1.169.2.53 file.c
--- file.c	25 Sep 2006 12:25:29 -0000	1.169.2.53
+++ file.c	15 Nov 2006 14:22:54 -0000
 -821,5
+821,5  group_member(gid)
 {
 #ifndef _WIN32
-    if (getgid() ==  gid)
+    if (getgid() == gid || getegid() == gid)
 	return Qtrue;
 
 -883,5
+883,5  eaccess(path, mode)
     if (st.st_uid == euid)        /* owner */
 	mode <<= 6;
-    else if (getegid() == st.st_gid ||
group_member(st.st_gid))
+    else if (group_member(st.st_gid))
 	mode <<= 3;
 
 -1329,5
+1329,5  test_grpowned(obj, fname)
 
     if (rb_stat(fname, &st) < 0) return Qfalse;
-    if (st.st_gid == getegid()) return Qtrue;
+    if (group_member(st.st_gid)) return Qtrue;
 #endif
     return Qfalse;
 -3741,5
+3741,5  rb_stat_grpowned(obj)
 {
 #ifndef _WIN32
-    if (get_stat(obj)->st_gid == getegid()) return
Qtrue;
+    if (group_member(get_stat(obj)->st_gid)) return
Qtrue;
 #endif
     return Qfalse;


-- 
Nobu Nakada

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )