Red Hat Bugzilla – Bug 236647
Last modified: 2007-11-30 17:12:02 EST
Etc.getgrgid returns root always!
irb(main):001:0> require 'etc'
=> #<struct Struct::Group name="root", passwd="x", gid=0, mem=["root"]>
$ rpm -q ruby
Looking at the code it is obvious why it doesn't work.
VALUE obj, id;
struct group *grp;
gid = getgid();
grp = getgrgid(gid);
if (grp == 0) rb_raise(rb_eArgError, "can't find group for %d", gid);
The attached patch, which reverts Etc::getgrgid to what's in both the 1.8.5 and
1.8.6 branches (no idea what happened with p35), seems to work .. at least on
i386 .. at least with the very simple test of
ruby -retc -e 'p Etc::getgrgid(1)'
#<struct Struct::Group name="bin", passwd="x", gid=1, mem=["root", "bin",
Created attachment 152729 [details]
Patch promised in #3
Created attachment 152730 [details]
Trivial patch for spec file
Patch for ruby.spec
Looks like this bug has been fixed in Ruby SVN as well:
Thanks for certain info.
Fixed in 126.96.36.199-1.fc6. sorry for taking a long time for this bug.