public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-portage-dev] [PATCH] Redirect /dev/fd bash test to /dev/null (bug 552340)
@ 2015-06-17  5:23 Zac Medico
  2015-06-17  6:46 ` Alexander Berntsen
  0 siblings, 1 reply; 2+ messages in thread
From: Zac Medico @ 2015-06-17  5:23 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: Zac Medico

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
---
 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)
-- 
2.3.5



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [gentoo-portage-dev] [PATCH] Redirect /dev/fd bash test to /dev/null (bug 552340)
  2015-06-17  5:23 [gentoo-portage-dev] [PATCH] Redirect /dev/fd bash test to /dev/null (bug 552340) Zac Medico
@ 2015-06-17  6:46 ` Alexander Berntsen
  0 siblings, 0 replies; 2+ messages in thread
From: Alexander Berntsen @ 2015-06-17  6:46 UTC (permalink / raw
  To: gentoo-portage-dev

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

I guess this makes sense. Go ahead & push.
- -- 
Alexander
bernalex@gentoo.org
https://secure.plaimi.net/~alexander
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCgAGBQJVgRfTAAoJENQqWdRUGk8BYzoP/2Z8wJTsxoCnlvB3zwpGMP+j
4jHt5ggOD52Bv8cwV9yQWmsOA0warfiCe1oRG/LkZXpvJFMyTSdn1DjsRdOYBKG3
9nRKlKwS4DXu+jNB1mYDKnI9vDLfLbdeLop96dBgpqR0o49norkNg/dI4QhzHN9v
+R7cuq58mFcESKFEAM6KtwWq7gzK+auR+V92/FEzp2TCgSMxHakx2cc6eWOkFn2n
Qta1/+fyEGym982Qsy78aE5PF0FuGC8NP8y9q1pXVe5hl4sEC6ol86cLKdNxmRkX
D3G3OTwRdHoM+o18jfN9Yy9ZV78iLQzQJ12k1oyDMyre2hoV0ra4xEvigr6fA8Oz
qU825RlcPl7wesk5NOV/uNspEpmZPljDkUkVFki9FzozRVTlJ2K1p6MXYMqGiA3P
fw08QWa/LsodtfOnf6ryaJ/8n9OPU+hOBAE4GllYXttQhcqp3hDG6RhrX/eTdaDs
EcODgk9um51yNftu1peyoLexeWHo/frdmua3pBvbBVwD2Yn2tumLkNK5B23fUIX0
FJ3BNuHJZvyrz/wE90sVYCjkamvmQu07J1SoTHtS0Oh5Vyt2HgH9fa4fj+k9R2jf
O35dBou/vL8vJcnlTyVuXVQxrFNt4FfMxqhSFwjeq26LA5fMRuQWO7Sgwl0wdzaA
re5pbZ28movyuBAz4AAR
=A3a5
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-06-17  6:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-17  5:23 [gentoo-portage-dev] [PATCH] Redirect /dev/fd bash test to /dev/null (bug 552340) Zac Medico
2015-06-17  6:46 ` Alexander Berntsen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox