As a workaround for bug #147625, spawn `id -g portage` in order to get a list of...
authorZac Medico <zmedico@gentoo.org>
Thu, 4 Jan 2007 21:13:45 +0000 (21:13 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 4 Jan 2007 21:13:45 +0000 (21:13 -0000)
svn path=/main/trunk/; revision=5461

pym/portage_data.py

index 0f846a8e26209f14b7f0c0f96a707acc676acf91..b7344222f229c82d3d0ae9e025a2c26409923feb 100644 (file)
@@ -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