Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.

Bug 236647

Summary: Etc.getgrgid broken?
Product: [Fedora] Fedora Reporter: Kostas Georgiou <k.georgiou>
Component: rubyAssignee: Akira TAGOH <tagoh>
Status: CLOSED CURRENTRELEASE QA Contact: Bill Huang <bhuang>
Severity: medium Docs Contact:
Priority: medium    
Version: 6CC: jeff, lutter
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-09-10 21:50:36 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Description Flags
Patch promised in #3
Trivial patch for spec file none

Description Kostas Georgiou 2007-04-16 22:39:11 UTC
Etc.getgrgid returns root always!

$ irb
irb(main):001:0> require 'etc'
=> true
irb(main):002:0> Etc.getgrgid(37)
=> #<struct Struct::Group name="root", passwd="x", gid=0, mem=["root"]>

$ rpm -q ruby

Comment 1 Kostas Georgiou 2007-04-17 00:07:58 UTC
Looking at the code it is obvious why it doesn't work.

static VALUE
etc_getgrgid(obj, id)
    VALUE obj, id;
    gid_t gid;
    struct group *grp;

    gid = getgid();
    grp = getgrgid(gid);
    if (grp == 0) rb_raise(rb_eArgError, "can't find group for %d", gid);
    return setup_group(grp);
    return Qnil;

Comment 2 David Lutterkort 2007-04-17 00:34:07 UTC
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",

Comment 3 David Lutterkort 2007-04-17 00:35:28 UTC
Created attachment 152729 [details]
Patch promised in #3

Comment 4 David Lutterkort 2007-04-17 00:39:18 UTC
Created attachment 152730 [details]
Trivial patch for spec file

Patch for ruby.spec

Comment 6 Akira TAGOH 2007-04-17 09:46:41 UTC
Thanks for certain info.

Comment 7 Akira TAGOH 2007-06-21 03:05:49 UTC
Fixed in sorry for taking a long time for this bug.