From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists.gentoo.org ([140.105.134.102] helo=robin.gentoo.org) by nuthatch.gentoo.org with esmtp (Exim 4.50) id 1EVoNp-0007UY-5p for garchives@archives.gentoo.org; Sat, 29 Oct 2005 10:56:21 +0000 Received: from robin.gentoo.org (localhost [127.0.0.1]) by robin.gentoo.org (8.13.5/8.13.5) with SMTP id j9TAtiFn009884; Sat, 29 Oct 2005 10:55:44 GMT Received: from smtp.gentoo.org (smtp.gentoo.org [134.68.220.30]) by robin.gentoo.org (8.13.5/8.13.5) with ESMTP id j9TAthws008283 for ; Sat, 29 Oct 2005 10:55:43 GMT Received: from zh034158.ppp.dion.ne.jp ([222.3.34.158] helo=opteron246.suzuki-stubbs.home) by smtp.gentoo.org with esmtpa (Exim 4.43) id 1EVoND-0000sb-5H for gentoo-portage-dev@lists.gentoo.org; Sat, 29 Oct 2005 10:55:43 +0000 Received: by opteron246.suzuki-stubbs.home (Postfix, from userid 1000) id B3D65248ADB; Sat, 29 Oct 2005 19:56:47 +0900 (JST) From: Jason Stubbs To: gentoo-portage-dev@lists.gentoo.org Subject: Re: [gentoo-portage-dev] [5/7] portage_exec cleanups Date: Sat, 29 Oct 2005 19:56:47 +0900 User-Agent: KMail/1.8.92 References: <200510231545.16596.jstubbs@gentoo.org> <200510291934.13207.jstubbs@gentoo.org> In-Reply-To: <200510291934.13207.jstubbs@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-portage-dev@gentoo.org Reply-to: gentoo-portage-dev@lists.gentoo.org MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_vV1YDERcuJ6RItZ" Message-Id: <200510291956.47607.jstubbs@gentoo.org> X-Archives-Salt: f32c24fe-0c96-451a-a421-bfb7b111f17b X-Archives-Hash: 87290f768ad8bb73b1f681d3f607e40b --Boundary-00=_vV1YDERcuJ6RItZ Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline All file descriptors opened by spawn() are now closed in the correct places. The code that closes all unnecessary descriptors via brute force is no longer required. I found that a file descriptor was being left open and passed around. However, it was definately not created in spawn(). It seems to me though that code outside of spawn should take care of closing (or telling spawn to close) any unnecessary FDs. --Boundary-00=_vV1YDERcuJ6RItZ Content-Type: text/x-diff; charset="utf-8"; name="05-remove-bulk-fd-closing.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="05-remove-bulk-fd-closing.patch" --- portage_exec.py.orig 2005-10-29 19:12:51.000000000 +0900 +++ portage_exec.py 2005-10-29 19:15:15.000000000 +0900 @@ -9,15 +9,6 @@ import portage_data import portage_util -try: - import resource - max_fd_limit=resource.getrlimit(RLIMIT_NOFILE) -except SystemExit, e: - raise -except: - # hokay, no resource module. - max_fd_limit=256 - spawned_pids = [] def cleanup(): global spawned_pids @@ -103,14 +94,6 @@ fd_unused.append(fd_pipes[x]) for x in fd_unused: os.close(x) - for x in range(0,max_fd_limit): - if x not in trg_fd: - try: - os.close(x) - except SystemExit, e: - raise - except: - pass # note this order must be preserved- can't change gid/groups if you change uid first. if gid: os.setgid(gid) --Boundary-00=_vV1YDERcuJ6RItZ-- -- gentoo-portage-dev@gentoo.org mailing list