Gentoo Archives: gentoo-portage-dev

From: Brian Harring <ferringb@g.o>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] [5/7] portage_exec cleanups
Date: Sat, 29 Oct 2005 17:19:08
Message-Id: 20051029171753.GP24883@nightcrawler
In Reply to: Re: [gentoo-portage-dev] [5/7] portage_exec cleanups by Jason Stubbs
1 On Sun, Oct 30, 2005 at 01:40:41AM +0900, Jason Stubbs wrote:
2 > Even with the fd_pipes, the try/except block in there covers a bug that is hit
3 > every time it is entered.
4 *cough* really doesn't surprise me. :)
5
6 > > Looking through the 2.4 subprocess module (which came along after the
7 > > mods in question), adding an option controlling the fd cleansing would
8 > > make sense, as long as the default option is to close the fds.
9 >
10 > Given the threading comment, I'd be agreeable to this. However, the spawn of
11 > tee would have to specifically close the write side of the pipe when unknown
12 > FDs aren't closed. Is having two extra paramaters, close_fds (a list) and
13 > close_all_fds (a bool), to spawn okay?
14
15 It's needed for any logged calls, doesn't mean I like it though. How
16 about this,
17 def spawn(...close_fds=True...):
18 if close_fds is True:
19 # kill all that aren't marked for open
20 elif close_fds:
21 # must be an iterable of what to kill
22 else:
23 #whatever code required to keep it from nuking file handles
24
25 Don't really like that one much myself, but it would allow for the
26 logging to use the existing structure, and one less option on the
27 overgrown spawn* prototype(s).
28
29
30 sidenote, since max_fd_limit needs to survive, tag
31 try:
32 import resource
33 - max_fd_limit=resource.getrlimit(RLIMIT_NOFILE)
34 + max_fd_limit=resource.getrlimit(resource.RLIMIT_NOFILE)
35 except SystemExit, e:
36 raise
37
38 in while you're at it, since that's obviously broke. Current code
39 would default to range(256), but default is 1024 fds for gentoo boxes
40 (so that _is_ a hole).
41 ~harring

Replies

Subject Author
Re: [gentoo-portage-dev] [5/7] portage_exec cleanups Jason Stubbs <jstubbs@g.o>