Hi,

2006/8/15, Ryan Davis <ryand-ruby / zenspider.com>:
> (sorry for repost, All I've added is a subject to attract eyes)
>
> I'm looking at Ticket # 5365 (Process.gid= fails on OS X) at:
>
>      http://rubyforge.org/tracker/?func=detail&atid=1698&aid=5365&group_id=426

And [ruby-core:8555] and the thread started from it?

> #1:
>
> The doco states:
>
>      Sets the group ID for this process.
>
> But the implementation only does a setgid if the desired gid is the
> effective gid. Given change_privilege, I think it is the doco that is
> wrong. Please confirm.

Indeed.  It should contain the word "real" as well as the
document of proc_getgid().

> #2/3:
>
> With regard to the implementation, it is preferring setregid over
> setegid/setgid, but my man page states (on both darwin and freebsd):
>
>       The setregid() function was intended to allow swapping the real and
>       effective group IDs in set-group-ID programs to temporarily relinquish
>       the set-group-ID value.  This function did not work correctly, and its
>       purpose is now better served by the use of the setegid() function (see
>       setuid(2)).
>
>       When setting the real and effective group IDs to the same value, the
>       standard setgid() function is preferred.

Since Process.gid= is inteded to set real gid only, keeping egid,
use of setgid() is not appropriate.

As for Mac OS X, setrgid() fails like as setregid(), since the
former just calls the latter.

http://darwinsource.opendarwin.org/10.4.6.x86/Libc-391.4.2/compat-43/FreeBSD/setrgid.c

> Note also that I changed the rb_notimplemented to be a correct error
> message for the situation.

Well, it feels reasonable to me.

> #4:
>
> If the doco is fine and #gid= should be able to set the gid,

That assumption is false.

-- 
Nobu Nakada