From 7661d96b77f86cb81e39498121af859deb407603 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 4 Jan 2007 21:13:45 +0000 Subject: [PATCH] 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 --- pym/portage_data.py | 17 +++++++++++++---- 1 file 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 -- 2.26.2