From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 469B31381F3 for ; Sun, 23 Jun 2013 22:41:02 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 088FCE095A; Sun, 23 Jun 2013 22:41:00 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 92547E095A for ; Sun, 23 Jun 2013 22:40:59 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 70F39335E33 for ; Sun, 23 Jun 2013 22:40:58 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 1FBB7E468F for ; Sun, 23 Jun 2013 22:40:57 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <1372027238.1d02521a635d81001fc5991ee9be6f8b293eeae3.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: bin/, pym/portage/ X-VCS-Repository: proj/portage X-VCS-Files: bin/helper-functions.sh pym/portage/process.py X-VCS-Directories: bin/ pym/portage/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 1d02521a635d81001fc5991ee9be6f8b293eeae3 X-VCS-Branch: master Date: Sun, 23 Jun 2013 22:40:57 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: ac8d363f-4b06-49c8-a7ce-ff8fee1fa298 X-Archives-Hash: 77082cb4973a61c67a660be75e1bc91e commit: 1d02521a635d81001fc5991ee9be6f8b293eeae3 Author: Zac Medico gentoo org> AuthorDate: Sun Jun 23 22:40:38 2013 +0000 Commit: Zac Medico gentoo org> CommitDate: Sun Jun 23 22:40:38 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=1d02521a Use /proc//fd for solaris compat, bug 474536 --- bin/helper-functions.sh | 6 +++++- pym/portage/process.py | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/bin/helper-functions.sh b/bin/helper-functions.sh index 65f41f6..eb6066f 100644 --- a/bin/helper-functions.sh +++ b/bin/helper-functions.sh @@ -76,10 +76,14 @@ __redirect_alloc_fd() { else # Need to provide the functionality ourselves. local fd=10 + local fddir=/dev/fd + # Use /proc//fd if available (/dev/fd + # doesn't work on solaris, see bug #474536). + [[ -d /proc/${BASHPID}/fd ]] && fddir=/proc/${BASHPID}/fd while :; do # Make sure the fd isn't open. It could be a char device, # or a symlink (possibly broken) to something else. - if [[ ! -e /dev/fd/${fd} ]] && [[ ! -L /dev/fd/${fd} ]] ; then + if [[ ! -e ${fddir}/${fd} ]] && [[ ! -L ${fddir}/${fd} ]] ; then eval "exec ${fd}${redir}'${file}'" && break fi [[ ${fd} -gt 1024 ]] && die "__redirect_alloc_fd failed" diff --git a/pym/portage/process.py b/pym/portage/process.py index 7104552..df8a891 100644 --- a/pym/portage/process.py +++ b/pym/portage/process.py @@ -31,7 +31,9 @@ except ImportError: if sys.hexversion >= 0x3000000: basestring = str -for _fd_dir in ("/dev/fd", "/proc/self/fd"): +# Use /proc//fd if available (/dev/fd +# doesn't work on solaris, see bug #474536). +for _fd_dir in ("/proc/%s/fd" % os.getpid(), "/dev/fd", "/proc/self/fd"): if os.path.isdir(_fd_dir): break else: