From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id D119C138334 for ; Mon, 2 Sep 2019 20:13:54 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 02EB9E082B; Mon, 2 Sep 2019 20:13:54 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id DAE71E082B for ; Mon, 2 Sep 2019 20:13:53 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id BA13534A9C3 for ; Mon, 2 Sep 2019 20:13:52 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id A3E56615 for ; Mon, 2 Sep 2019 20:13:50 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <1567455086.7cb7196fe8aa668e76437a8a4500a7bcb9fd3c75.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: lib/portage/package/ebuild/ X-VCS-Repository: proj/portage X-VCS-Files: lib/portage/package/ebuild/doebuild.py X-VCS-Directories: lib/portage/package/ebuild/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 7cb7196fe8aa668e76437a8a4500a7bcb9fd3c75 X-VCS-Branch: master Date: Mon, 2 Sep 2019 20:13:50 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: c3e98fd9-fcb3-4074-a6e2-7d40f13fa17e X-Archives-Hash: 2039daae766bd503d4a922a1fdd9f9c5 commit: 7cb7196fe8aa668e76437a8a4500a7bcb9fd3c75 Author: Arfrever Frehtes Taifersar Arahesis Apache Org> AuthorDate: Mon Sep 2 05:32:09 2019 +0000 Commit: Zac Medico gentoo org> CommitDate: Mon Sep 2 20:11:26 2019 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=7cb7196f _doebuild_path: Optimize PATH in ebuild environment. Canonicalize paths of directories in PATH. Avoid duplicates when some directories (e.g. bin and sbin) are merged. Bug: https://bugs.gentoo.org/693306 Signed-off-by: Arfrever Frehtes Taifersar Arahesis Apache.Org> Signed-off-by: Zac Medico gentoo.org> lib/portage/package/ebuild/doebuild.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/portage/package/ebuild/doebuild.py b/lib/portage/package/ebuild/doebuild.py index 584ff798b..66e294d51 100644 --- a/lib/portage/package/ebuild/doebuild.py +++ b/lib/portage/package/ebuild/doebuild.py @@ -5,6 +5,7 @@ from __future__ import unicode_literals __all__ = ['doebuild', 'doebuild_environment', 'spawn', 'spawnebuild'] +import collections import grp import gzip import errno @@ -254,7 +255,14 @@ def _doebuild_path(settings, eapi=None): path.append(x_abs) path.extend(rootpath) - settings["PATH"] = ":".join(path) + + # Canonicalize paths and avoid duplicates when some directories + # (e.g. bin and sbin) are merged. + real_path = collections.OrderedDict() + for x in path: + real_path.setdefault(os.path.realpath(x), None) + + settings["PATH"] = ":".join(real_path) def doebuild_environment(myebuild, mydo, myroot=None, settings=None, debug=False, use_cache=None, db=None):