1 |
commit: 17cb113abf2b155b7b1f2955f7eed54f335badb0 |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Dec 30 00:21:17 2018 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Dec 30 00:59:46 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=17cb113a |
7 |
|
8 |
ResolverPlayground: exclude internal wrappers from essential_binaries PATH |
9 |
|
10 |
Ensure that essential_binaries symlinks do not refer to internal |
11 |
wrapper scripts, in order to avoid infinite recursion. Use the |
12 |
same ebuild-helpers pattern as the portageq wrapper script since |
13 |
daeb75b345c4433218ab9e7a5319e8914092f048. |
14 |
|
15 |
Fixes: 1b5edbb5ec70 ("_doebuild_path: do not use host PATH by default and prepend EPREFIX PATH") |
16 |
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org> |
17 |
|
18 |
lib/portage/tests/resolver/ResolverPlayground.py | 17 +++++++++++++++-- |
19 |
1 file changed, 15 insertions(+), 2 deletions(-) |
20 |
|
21 |
diff --git a/lib/portage/tests/resolver/ResolverPlayground.py b/lib/portage/tests/resolver/ResolverPlayground.py |
22 |
index 3997ad26e..626a1f064 100644 |
23 |
--- a/lib/portage/tests/resolver/ResolverPlayground.py |
24 |
+++ b/lib/portage/tests/resolver/ResolverPlayground.py |
25 |
@@ -108,8 +108,21 @@ class ResolverPlayground(object): |
26 |
"uniq", |
27 |
"xargs", |
28 |
) |
29 |
- for x in essential_binaries: |
30 |
- os.symlink(find_binary(x), os.path.join(eubin, x)) |
31 |
+ # Exclude internal wrappers from PATH lookup. |
32 |
+ orig_path = os.environ['PATH'] |
33 |
+ included_paths = [] |
34 |
+ for path in orig_path.split(':'): |
35 |
+ if path and not fnmatch.fnmatch(path, '*/portage/*/ebuild-helpers*'): |
36 |
+ included_paths.append(path) |
37 |
+ try: |
38 |
+ os.environ['PATH'] = ':'.join(included_paths) |
39 |
+ for x in essential_binaries: |
40 |
+ path = find_binary(x) |
41 |
+ if path is None: |
42 |
+ raise portage.exception.CommandNotFound(x) |
43 |
+ os.symlink(path, os.path.join(eubin, x)) |
44 |
+ finally: |
45 |
+ os.environ['PATH'] = orig_path |
46 |
else: |
47 |
self.eprefix = normalize_path(eprefix) |