commit:     2710f9ab525e7c726c2ffb027e242dbdf31cfe76
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Jun 26 20:14:09 2018 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Jun 26 20:16:25 2018 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=2710f9ab

binarytree._merge_pkgindex_header: deduplicate values (bug 657422)

Deduplicate values of implicit IUSE variables, in order to
prevent them from growing without bound, triggering "[Errno 7]
Argument list too long" errors as reported in bug 657422.

Fixes: cab78dba98c4 ("emerge --usepkgonly: propagate implicit IUSE and 
USE_EXPAND (bug 640318)")
Bug: https://bugs.gentoo.org/657422

 pym/portage/dbapi/bintree.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py
index 269a7b226..9c2d877e7 100644
--- a/pym/portage/dbapi/bintree.py
+++ b/pym/portage/dbapi/bintree.py
@@ -1320,7 +1320,9 @@ class binarytree(object):
                for k, v in iter_iuse_vars(src):
                        v_before = dest.get(k)
                        if v_before is not None:
-                               v = v_before + ' ' + v
+                               merged_values = set(v_before.split())
+                               merged_values.update(v.split())
+                               v = ' '.join(sorted(merged_values))
                        dest[k] = v
 
                if 'ARCH' not in dest and 'ARCH' in src:

Reply via email to