1 |
On Sunday 30 October 2005 02:17, Brian Harring wrote: |
2 |
> On Sun, Oct 30, 2005 at 01:40:41AM +0900, Jason Stubbs wrote: |
3 |
> > Even with the fd_pipes, the try/except block in there covers a bug that |
4 |
> > is hit every time it is entered. |
5 |
> |
6 |
> *cough* really doesn't surprise me. :) |
7 |
> |
8 |
> > > Looking through the 2.4 subprocess module (which came along after the |
9 |
> > > mods in question), adding an option controlling the fd cleansing would |
10 |
> > > make sense, as long as the default option is to close the fds. |
11 |
> > |
12 |
> > Given the threading comment, I'd be agreeable to this. However, the spawn |
13 |
> > of tee would have to specifically close the write side of the pipe when |
14 |
> > unknown FDs aren't closed. Is having two extra paramaters, close_fds (a |
15 |
> > list) and close_all_fds (a bool), to spawn okay? |
16 |
> |
17 |
> It's needed for any logged calls, doesn't mean I like it though. How |
18 |
> about this, |
19 |
> def spawn(...close_fds=True...): |
20 |
> if close_fds is True: |
21 |
> # kill all that aren't marked for open |
22 |
> elif close_fds: |
23 |
> # must be an iterable of what to kill |
24 |
> else: |
25 |
> #whatever code required to keep it from nuking file handles |
26 |
> |
27 |
> Don't really like that one much myself, but it would allow for the |
28 |
> logging to use the existing structure, and one less option on the |
29 |
> overgrown spawn* prototype(s). |
30 |
|
31 |
Yep, this sort of messyness is why I chose to back down. ;) |
32 |
|
33 |
> sidenote, since max_fd_limit needs to survive, tag |
34 |
> try: |
35 |
> import resource |
36 |
> - max_fd_limit=resource.getrlimit(RLIMIT_NOFILE) |
37 |
> + max_fd_limit=resource.getrlimit(resource.RLIMIT_NOFILE) |
38 |
> except SystemExit, e: |
39 |
> raise |
40 |
> |
41 |
> in while you're at it, since that's obviously broke. Current code |
42 |
> would default to range(256), but default is 1024 fds for gentoo boxes |
43 |
> (so that _is_ a hole). |
44 |
|
45 |
Got that one already, but I didn't want to point out too many bugs. ;) |
46 |
(There's still one more you missed there, btw; getrlimit() returns a tuple) |
47 |
|
48 |
-- |
49 |
Jason Stubbs |
50 |
-- |
51 |
gentoo-portage-dev@g.o mailing list |