Portage sets custom PATH with hardcoded elements: https://gitweb.gentoo.org/proj/portage.git/tree/lib/portage/package/ebuild/doebuild.py?id=26c8526293bd93906390d8fc830dc55052fc4d40#n204 ... for prefix in prefixes: prefix = prefix if prefix else "/" for x in ("usr/local/sbin", "usr/local/bin", "usr/sbin", "usr/bin", "sbin", "bin"): ... When some of these directories are merged (e.g. /bin + /sbin + /usr/bin + /usr/sbin), then it is not necessary to include effectively duplicate elements in PATH. I suggest to also canonicalize paths to make them look better.
Created attachment 588682 [details, diff] Patch
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/portage.git/commit/?id=7cb7196fe8aa668e76437a8a4500a7bcb9fd3c75 commit 7cb7196fe8aa668e76437a8a4500a7bcb9fd3c75 Author: Arfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org> AuthorDate: 2019-09-02 05:32:09 +0000 Commit: Zac Medico <zmedico@gentoo.org> CommitDate: 2019-09-02 20:11:26 +0000 _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 <Arfrever@Apache.Org> Signed-off-by: Zac Medico <zmedico@gentoo.org> lib/portage/package/ebuild/doebuild.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
Thanks!
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/portage.git/commit/?id=c9c2bcc619c6ff60e452205f94ae26d4afd44d82 commit c9c2bcc619c6ff60e452205f94ae26d4afd44d82 Author: Zac Medico <zmedico@gentoo.org> AuthorDate: 2019-09-03 08:34:08 -0700 Commit: Zac Medico <zmedico@gentoo.org> CommitDate: 2019-09-03 08:36:23 -0700 Revert "_doebuild_path: Optimize PATH in ebuild environment." This reverts commit 7cb7196fe8aa668e76437a8a4500a7bcb9fd3c75. Since binary and installed packages have persistent PATH settings in environment.bz2, using realpath on PATH components can break binary and installed package phases if the symlink layout is somehow modified. Therefore, the implications of changes like this need to be considered very carefully. Signed-off-by: Zac Medico <zmedico@gentoo.org> lib/portage/package/ebuild/doebuild.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-)