summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-01-04 21:13:45 +0000
committerZac Medico <zmedico@gentoo.org>2007-01-04 21:13:45 +0000
commit7661d96b77f86cb81e39498121af859deb407603 (patch)
tree15702e57acc6a39458092ce6fb402c6d4060070d
parent1554c6229999783fbf0a3f7d5303ea21d0e8ec3d (diff)
downloadportage-7661d96b77f86cb81e39498121af859deb407603.tar.gz
portage-7661d96b77f86cb81e39498121af859deb407603.tar.bz2
portage-7661d96b77f86cb81e39498121af859deb407603.zip
As a workaround for bug #147625, spawn `id -g portage` in order to get a list of groups for the portage user without the need to call grp.getgrall().
svn path=/main/trunk/; revision=5461
-rw-r--r--pym/portage_data.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/pym/portage_data.py b/pym/portage_data.py
index 0f846a8e2..b7344222f 100644
--- a/pym/portage_data.py
+++ b/pym/portage_data.py
@@ -111,7 +111,16 @@ except KeyError:
userpriv_groups = [portage_gid]
if secpass >= 2:
- for g in grp.getgrall():
- if "portage" in g[3]:
- userpriv_groups.append(g[2])
- userpriv_groups = list(set(userpriv_groups))
+ # Get a list of group IDs for the portage user. Do not use grp.getgrall()
+ # since it is known to trigger spurious SIGPIPE problems with nss_ldap.
+ from commands import getstatusoutput
+ mystatus, myoutput = getstatusoutput("id -g portage")
+ if mystatus == os.EX_OK:
+ for x in myoutput.split():
+ try:
+ userpriv_groups.append(int(x))
+ except ValueError:
+ pass
+ del x
+ userpriv_groups = list(set(userpriv_groups))
+ del getstatusoutput, mystatus, myoutput