Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 344307 - portage doesn't work if the user's group id is numeric
Summary: portage doesn't work if the user's group id is numeric
Status: RESOLVED FIXED
Alias: None
Product: Gentoo/Alt
Classification: Unclassified
Component: Prefix Support (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Prefix
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-05 18:27 UTC by Tom Menari
Modified: 2014-05-16 01:06 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
add case for numeric group id (getgrnam.patch,869 bytes, patch)
2010-11-05 18:38 UTC, Tom Menari
Details | Diff
fix of previous patch (getgrnam.patch,869 bytes, patch)
2010-11-05 18:40 UTC, Tom Menari
Details | Diff
portage-numeric-group (portage-numeric-group.patch,1.08 KB, patch)
2010-11-30 18:07 UTC, Fabian Groffen
Details | Diff
portage-numeric-group.patch (portage-numeric-gid.patch,3.29 KB, patch)
2014-01-22 22:31 UTC, Ruud Koolen (RETIRED)
Details | Diff
portage-numeric-group.patch (portage-numeric-gid.patch,3.30 KB, patch)
2014-01-22 23:45 UTC, Ruud Koolen (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Menari 2010-11-05 18:27:15 UTC
On my University's shell server, each user is assigned their own group, but these groups are only numeric and not named. This upsets the version of portage used in gentoo-prefix.

Reproducible: Always

Steps to Reproduce:
1. have a user account whose primary group is numeric
2. run any emerge command

Actual Results:  
$ time FEATURES="-collision-protect" emerge -avg system
Traceback (most recent call last):
  File "/home/tom/gentoo/usr/bin/emerge", line 38, in <module>
    from _emerge.main import emerge_main
  File "/home/tom/gentoo/usr/lib/portage/pym/_emerge/main.py", line 31, in <module>
    import portage.locks
  File "/home/tom/gentoo/usr/lib/portage/pym/portage/locks.py", line 16, in <module>
    from portage.data import portage_gid
  File "/home/tom/gentoo/usr/lib/portage/pym/portage/data.py", line 96, in <module>
    "portage: "+portageuser+" user or "+portagegroup+" group missing.") + "\n", noiselevel=-1)
NameError: name 'portageuser' is not defined


Expected Results:  
ran emerge as normal

The attached diff fixes the problem for me, but is no good for a general case.
Comment 1 Tom Menari 2010-11-05 18:38:07 UTC
Created attachment 253329 [details, diff]
add case for numeric group id
Comment 2 Tom Menari 2010-11-05 18:40:35 UTC
Created attachment 253331 [details, diff]
fix of previous patch
Comment 3 Fabian Groffen gentoo-dev 2010-11-09 18:10:40 UTC
can you post the output of `id`?

does
  portage_gid = grp.getgrgid(_portage_grpname)[2]
return anything?
Comment 4 Tom Menari 2010-11-09 19:03:59 UTC
$ id
uid=15342(tam9) gid=15342 groups=15342

$ python -c 'import grp; grp.getgrgid("15342")'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
KeyError: 'getgrgid(): gid not found: 15342'
Comment 5 Fabian Groffen gentoo-dev 2010-11-30 18:07:17 UTC
Created attachment 255981 [details, diff]
portage-numeric-group

I'm going to commit this patch, which should deal with your issue, I hope.
Comment 6 Fabian Groffen gentoo-dev 2010-11-30 19:44:48 UTC
the fix is in 2.2.01.17304
Comment 7 Ruud Koolen (RETIRED) archtester gentoo-dev Security 2014-01-22 22:31:35 UTC
Created attachment 368474 [details, diff]
portage-numeric-group.patch

This is broken again in current portage; reopening. Attached patch fixes it.
Comment 8 Ruud Koolen (RETIRED) archtester gentoo-dev Security 2014-01-22 23:45:44 UTC
Created attachment 368490 [details, diff]
portage-numeric-group.patch

This version also works with python 3, unlike the previous version.
Comment 9 Fabian Groffen gentoo-dev 2014-02-08 10:23:26 UTC
[prefix 1604d62] portage_gid: allow numeric groups
Comment 10 Ruud Koolen (RETIRED) archtester gentoo-dev Security 2014-05-16 01:06:13 UTC
Fixed in 2.2.10.