Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 236647 - Etc.getgrgid broken?
Etc.getgrgid broken?
Product: Fedora
Classification: Fedora
Component: ruby (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Akira TAGOH
Bill Huang
Depends On:
  Show dependency treegraph
Reported: 2007-04-16 18:39 EDT by Kostas Georgiou
Modified: 2007-11-30 17:12 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2007-09-10 17:50:36 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Patch promised in #3 (388 bytes, text/x-patch)
2007-04-16 20:35 EDT, David Lutterkort
no flags Details
Trivial patch for spec file (1.06 KB, patch)
2007-04-16 20:39 EDT, David Lutterkort
no flags Details | Diff

  None (edit)
Description Kostas Georgiou 2007-04-16 18:39:11 EDT
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-16 20:07:58 EDT
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-16 20:34:07 EDT
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-16 20:35:28 EDT
Created attachment 152729 [details]
Patch promised in #3
Comment 4 David Lutterkort 2007-04-16 20:39:18 EDT
Created attachment 152730 [details]
Trivial patch for spec file

Patch for ruby.spec
Comment 6 Akira TAGOH 2007-04-17 05:46:41 EDT
Thanks for certain info.
Comment 7 Akira TAGOH 2007-06-20 23:05:49 EDT
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.