public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Jason Stubbs <jstubbs@gentoo.org>
To: gentoo-portage-dev@lists.gentoo.org
Subject: Re: [gentoo-portage-dev] [5/7] portage_exec cleanups
Date: Sun, 30 Oct 2005 02:20:02 +0900	[thread overview]
Message-ID: <200510300220.02458.jstubbs@gentoo.org> (raw)
In-Reply-To: <200510300140.41639.jstubbs@gentoo.org>

[-- Attachment #1: Type: text/plain, Size: 124 bytes --]

Trying to alter patches that have been split up is a PITA. Missed a var rename 
in the patch just sent. :/

--
Jason Stubbs

[-- Attachment #2: 05-bulk-fd-closing-take2.patch --]
[-- Type: text/x-diff, Size: 1409 bytes --]

--- portage_exec.py.orig	2005-10-30 02:05:50.000000000 +0900
+++ portage_exec.py	2005-10-30 02:18:24.000000000 +0900
@@ -11,11 +11,8 @@
 
 try:
 	import resource
-	max_fd_limit=resource.getrlimit(RLIMIT_NOFILE)
-except SystemExit, e:
-	raise
-except:
-	# hokay, no resource module.
+	max_fd_limit=resource.getrlimit(resource.RLIMIT_NOFILE)[1]
+except ImportError:
 	max_fd_limit=256
 
 spawned_pids = []
@@ -83,7 +80,7 @@
 	mypid=[]
 	if logfile:
 		pr,pw=os.pipe()
-		mypid.extend(spawn(('tee','-i','-a',logfile),returnpid=True,fd_pipes={0:pr,1:fd_pipes[1],2:fd_pipes[2]},fd_unused=[pw]))
+		mypid.extend(spawn(('tee','-i','-a',logfile),returnpid=True,fd_pipes={0:pr,1:fd_pipes[1],2:fd_pipes[2]}))
 		os.close(pr)
 		fd_pipes[1]=pw
 		fd_pipes[2]=pw
@@ -95,22 +92,15 @@
 	mypid.append(os.fork())
 	if mypid[-1] == 0:
 		my_pipes = {}
-		close_pipes = {}
 		for x in fd_pipes:
 			my_pipes[x] = os.dup(fd_pipes[x])
-			close_pipes[fd_pipes[x]] = True
-		for x in close_pipes:
-			os.close(x)
 		for x in my_pipes:
 			os.dup2(my_pipes[x], x)
-			os.close(my_pipes[x])
-		for x in range(0,max_fd_limit):
-			if x not in trg_fd:
-				try: 
+		for x in range(max_fd_limit):
+			if x not in my_pipes:
+				try:
 					os.close(x)
-				except SystemExit, e:
-					raise
-				except:
+				except OSError:
 					pass
 		# note this order must be preserved- can't change gid/groups if you change uid first.
 		if gid:

  parent reply	other threads:[~2005-10-29 17:19 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-23  6:45 [gentoo-portage-dev] [Bug 104705] emerge doesn't print complete error message Jason Stubbs
2005-10-29 10:34 ` [gentoo-portage-dev] [0/7] portage_exec cleanups (WAS: [Bug 104705] emerge doesn't print complete error message) Jason Stubbs
2005-10-29 10:41   ` [gentoo-portage-dev] [1/7] portage_exec cleanups Jason Stubbs
2005-10-29 10:44   ` [gentoo-portage-dev] [2/7] " Jason Stubbs
2005-10-29 10:49   ` [gentoo-portage-dev] [3/7] " Jason Stubbs
2005-10-29 14:22     ` Brian Harring
2005-10-29 15:06       ` Jason Stubbs
2005-10-29 15:17         ` Brian Harring
2005-10-29 10:52   ` [gentoo-portage-dev] [4/7] " Jason Stubbs
2005-10-29 11:03     ` Jason Stubbs
2005-10-29 10:56   ` [gentoo-portage-dev] [5/7] " Jason Stubbs
2005-10-29 15:25     ` Jason Stubbs
2005-10-29 16:04       ` Brian Harring
2005-10-29 16:40         ` Jason Stubbs
2005-10-29 17:17           ` Jason Stubbs
2005-10-29 17:17           ` Brian Harring
2005-10-29 17:28             ` Jason Stubbs
2005-10-29 17:20           ` Jason Stubbs [this message]
2005-10-29 17:28             ` Brian Harring
2005-10-29 10:57   ` [gentoo-portage-dev] [6/7] " Jason Stubbs
2005-10-29 11:01   ` [gentoo-portage-dev] [7/7] " Jason Stubbs
2005-10-29 17:32   ` [gentoo-portage-dev] [0/7] portage_exec cleanups (WAS: [Bug 104705] emerge doesn't print complete error message) Jason Stubbs
2005-10-29 17:38     ` Jason Stubbs
2005-10-30  7:03   ` Jason Stubbs

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=200510300220.02458.jstubbs@gentoo.org \
    --to=jstubbs@gentoo.org \
    --cc=gentoo-portage-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