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 - Etc.getgrgid broken?
Summary: Etc.getgrgid broken?
Alias: None
Product: Fedora
Classification: Fedora
Component: ruby
Version: 6
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Akira TAGOH
QA Contact: Bill Huang
Depends On:
TreeView+ depends on / blocked
Reported: 2007-04-16 22:39 UTC by Kostas Georgiou
Modified: 2007-11-30 22:12 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2007-09-10 21:50:36 UTC

Attachments (Terms of Use)
Patch promised in #3 (deleted)
2007-04-17 00:35 UTC, David Lutterkort
no flags Details
Trivial patch for spec file (deleted)
2007-04-17 00:39 UTC, David Lutterkort
no flags Details | Diff

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.

Note You need to log in before you can comment on or make changes to this bug.