commit: f5cdbf6af191c857b2c13455cb4d2d7b844c05f4
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed Jun 17 05:21:05 2015 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed Jun 17 06:54:36 2015 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=f5cdbf6a
Redirect /dev/fd bash test to /dev/null (bug 552340)
The /dev/fd test from commit 7fab3aadb4cdca35ce0d81525af1256c745308ff
shows a bash error message unecessarily.
Fixes: 7fab3aadb4cd ("Add another check for broken /dev/s (bug 538980)")
X-Gentoo-Bug: 552340
X-Gentoo-Bug-url: https://bugs.gentoo.org/show_bug.cgi?id=552340
Acked-by: Alexander Berntsen <bernalex <AT> gentoo.org>
pym/_emerge/main.py | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
index a5dafa3..b69aa24 100644
--- a/pym/_emerge/main.py
+++ b/pym/_emerge/main.py
@@ -1126,12 +1126,19 @@ def emerge_main(args=None):
# Verify that BASH process substitution works as another cheap early
# filter. Process substitution uses '/dev/fd'.
- if portage.process.spawn_bash("[[ $(< <(echo foo) ) == foo ]]") != 0:
- writemsg_level("Failed to validate a sane '/dev'.\n"
- "bash process substitution doesn't work; this
may be an "
- "indication of a broken '/dev/fd'.\n",
- level=logging.ERROR, noiselevel=-1)
- return 1
+ with open(os.devnull, 'r+b') as dev_null:
+ fd_pipes = {
+ 0: dev_null.fileno(),
+ 1: dev_null.fileno(),
+ 2: dev_null.fileno(),
+ }
+ if portage.process.spawn_bash("[[ $(< <(echo foo) ) == foo ]]",
+ fd_pipes=fd_pipes) != 0:
+ writemsg_level("Failed to validate a sane '/dev'.\n"
+ "bash process substitution doesn't work; this
may be an "
+ "indication of a broken '/dev/fd'.\n",
+ level=logging.ERROR, noiselevel=-1)
+ return 1
# Portage needs to ensure a sane umask for the files it creates.
os.umask(0o22)