This is the mail archive of the
cygwin-developers
mailing list for the Cygwin project.
Re: 1.7.5: Occasional failure of CreatePipe or signal handing due to thread-unsafe code in cwdstuff::set
On Aug 12 22:47, Corinna Vinschen wrote:
> * cygheap.h (class cwdstuff): Make drive_length private.
> Add "error" member.
> (cwdstuff::get_error): New inline method.
> (cwdstuff::get_error_desc): Declare.
> (cwdstuff::set): Change first parameter to pointer to path_conv.
> Drop unused third parameter.
> * path.cc (chdir): Drop doit. Align call to cwdstuff::set to
> new arguments.
> (cwdstuff::init): Drop third parameter in call to cwdstuff::set.
> (cwdstuff::set): Partially rewrite. Drop "doit" since it's not
> used anymore. Always create new handle to CWD if not in a virtual
> path. Check for accessibility to set correct error code. Drop
> Vista workaround. Never write back into PEB. Set Win32 CWD to
> \\?\PIPE\ on init. Simplify creation of win32 path. Set new
> error member to a meaningful value.
> (cwdstuff::get_error_desc): New method to generate error message
> from cwd error code.
> * spawn.cc (spawn_guts): Call cwdstuff::get_error_desc to create
> more meaningful error message when not being able to start native
> Win32 app due to CWD restrictions. When starting native Win32 app,
> lock cwd and use in calls to CreateProcessW/CreateProcessAsUserW.
I've checked in a revised version which
- speeds up exec startup by not calling cwdstuff::set from
cwdstuff::init if the cwd was already initialized by the parent
processes,
- which in turn simplifies the cwdstuff::set function a lot.
- actually closes the former CWD handle so we don't have a handle
leak on every invokation of cwdstuff::set,
- contains much more comments now, so we hopefully still understand the
code in a couple of months,
- last but not least adds a full set of documentation describing the
restrictions on the Win32 API level. I also added the Win32
environment restriction we already have for years.
I mulled over the idea to convert the new cwdstuff::get_error_desc
method into a static array, but given that this array is only used if a
native Win32 application is NOT called, I dropped the idea again.
My tests are going rather well, so I hope I didn't screw up too much.
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Project Co-Leader cygwin AT cygwin DOT com
Red Hat