sftp breakage on Win32
John A Meinel
john at arbash-meinel.com
Thu Dec 1 16:21:14 GMT 2005
David Allouche wrote:
> On Wed, 2005-11-30 at 12:12 -0500, Matt Lavin wrote:
>> After catching up with bzr.dev on my Windows machine I ran into the
>> following problem using sftp on Windows. To work around the issue I
>> just removed the 'close_fds' argument, but I doubt that it the best
>> solution. I checked the Python docs and it doesn't mention that the
>> argument is not supported on Windows.
>
> From memory, when I looked quite closely at how subprocess handled
> process spawning and compared it to twisted, and asked Robert Collins
> for extra information:
>
> * On win32, fds are not inherited, you have to pass them
> explicitly across to the subprocess. So close_fds is implicit on
> win32.
> * That's probably one reason why twisted will close all fds not
> explicitely passed to the subprocess, which makes process
> spawning in twisted quite needlessly expensive (it iterate over
> all 32k entries of the fd space).
> * The subprocess module does not provide support for passing
> anything but stdio fds. Except when using the preexec callback
> which is not supported on windows either because subprocesses
> there are created by spawn, not by fork-exec.
>
> In my opinion, the subprocess module sucks seriously in that particular
> respect, but it's still clearly the least broken process spawning
> facility available in the standard library.
>
> So, if my understanding of the situation is correct, and you care about
> close_fds, you need to duplicate the os.name check done in the
> subprocess module and pass close_fds set close_fds to true if and only
> if that test says it's not windows.
>
> However, you probably do not need to care about close_fds because, as
> far as I know, the number of open fds on a file only makes a difference
> for pipes (i/o on a pipe may block instead of failing if some subprocess
> has a stray fd to this pipe).
>
> Caveats, that's all from memory, and I do not really know anything about
> windows process and fd handling.
Thanks for more info. I did do a check for "sys.platform" which sets
close_fds as appropriate.
I agree we probably don't really care about them. I think the main
reason is just for security. Just to have as streamlined a subprocess as
we can.
John
=:->
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 249 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20051201/f8f7b4b8/attachment.pgp
More information about the bazaar
mailing list