1 |
The /dev/fd test from commit 7fab3aadb4cdca35ce0d81525af1256c745308ff |
2 |
shows a bash error message unecessarily. |
3 |
|
4 |
Fixes: 7fab3aadb4cd ("Add another check for broken /dev/s (bug 538980)") |
5 |
X-Gentoo-Bug: 552340 |
6 |
X-Gentoo-Bug-url: https://bugs.gentoo.org/show_bug.cgi?id=552340 |
7 |
--- |
8 |
pym/_emerge/main.py | 19 +++++++++++++------ |
9 |
1 file changed, 13 insertions(+), 6 deletions(-) |
10 |
|
11 |
diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py |
12 |
index a5dafa3..b69aa24 100644 |
13 |
--- a/pym/_emerge/main.py |
14 |
+++ b/pym/_emerge/main.py |
15 |
@@ -1126,12 +1126,19 @@ def emerge_main(args=None): |
16 |
|
17 |
# Verify that BASH process substitution works as another cheap early |
18 |
# filter. Process substitution uses '/dev/fd'. |
19 |
- if portage.process.spawn_bash("[[ $(< <(echo foo) ) == foo ]]") != 0: |
20 |
- writemsg_level("Failed to validate a sane '/dev'.\n" |
21 |
- "bash process substitution doesn't work; this may be an " |
22 |
- "indication of a broken '/dev/fd'.\n", |
23 |
- level=logging.ERROR, noiselevel=-1) |
24 |
- return 1 |
25 |
+ with open(os.devnull, 'r+b') as dev_null: |
26 |
+ fd_pipes = { |
27 |
+ 0: dev_null.fileno(), |
28 |
+ 1: dev_null.fileno(), |
29 |
+ 2: dev_null.fileno(), |
30 |
+ } |
31 |
+ if portage.process.spawn_bash("[[ $(< <(echo foo) ) == foo ]]", |
32 |
+ fd_pipes=fd_pipes) != 0: |
33 |
+ writemsg_level("Failed to validate a sane '/dev'.\n" |
34 |
+ "bash process substitution doesn't work; this may be an " |
35 |
+ "indication of a broken '/dev/fd'.\n", |
36 |
+ level=logging.ERROR, noiselevel=-1) |
37 |
+ return 1 |
38 |
|
39 |
# Portage needs to ensure a sane umask for the files it creates. |
40 |
os.umask(0o22) |
41 |
-- |
42 |
2.3.5 |