On Jun 26 16:59, Jeremy Drake via Cygwin-patches wrote:
> Currently just file actions open/close/dup2 are supported in the fast
> path.

I'm wondering about that a bit, see below.

Also, ETOOSHORTCOMMITMESSAGE

> +           case __posix_spawn_file_actions_entry::FAE_DUP2:
> +             if (fae->fae_newfildes < 0 || fae->fae_newfildes > 2)
> +               goto closes;

Hmmmm.  So we only may dup2/open/close stdin/out/err?  That's not
exactly what POSIX requires.

I understand that this is because CreateProcess or better, Windows, only
defines three handles which can be unambiguously connected to descriptor
numbers, but theoretically, this restriction should only apply to
non-Cygwin executables.

Actually, I think this code path should really only be used with
non-native executables.  With Cygwin executables, all the actions should
be performed in the child process.  This is basically a job for
child_info_spawn::handle_spawn() in dcrt0.cc.

With only one exception: if the executable path is relative, create an
absolute path by emulating (but not actually executing) the chdir/fchdir
calls inside the file_action object.

As for this code, it wouldn't hurt to add more comments explicitely
describing what it's doing and why.  I would add the first comment
already when defining the fds array ;)


Thanks,
Corinna

Reply via email to