public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Zac Medico" <zmedico@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:master commit in: bin/, pym/portage/
Date: Sun, 23 Jun 2013 22:40:57 +0000 (UTC)	[thread overview]
Message-ID: <1372027238.1d02521a635d81001fc5991ee9be6f8b293eeae3.zmedico@gentoo> (raw)

commit:     1d02521a635d81001fc5991ee9be6f8b293eeae3
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 23 22:40:38 2013 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> 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/<pid>/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/<pid>/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/<pid>/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:


             reply	other threads:[~2013-06-23 22:41 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-23 22:40 Zac Medico [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-11-17 17:43 [gentoo-commits] proj/portage:master commit in: bin/, pym/portage/ Zac Medico
2013-11-29 23:24 Mike Frysinger
2013-06-25  7:48 Zac Medico
2013-06-23 22:57 Zac Medico
2013-02-11  9:39 Zac Medico
2013-01-19  5:16 Zac Medico
2013-01-19  5:00 Zac Medico
2013-01-19  3:23 Zac Medico
2013-01-19  3:23 Zac Medico
2013-01-19  2:27 Zac Medico
2013-01-19  1:53 Zac Medico
2012-10-18  0:05 Zac Medico
2012-03-17 16:44 Zac Medico
2012-03-11  1:40 Mike Frysinger
2011-12-08  7:26 Zac Medico
2011-06-17 22:35 Zac Medico
2011-06-04  1:39 Zac Medico
2011-02-20  0:00 Zac Medico

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1372027238.1d02521a635d81001fc5991ee9be6f8b293eeae3.zmedico@gentoo \
    --to=zmedico@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox