1.7.5: Occasional failure of CreatePipe or signal handing due to thread-unsafe code in cwdstuff::set

Andy Koppe andy.koppe@gmail.com
Thu Aug 12 06:17:00 GMT 2010

On 11 August 2010 21:33, Christopher Faylor wrote:
>On Wed, Aug 11, 2010 at 07:14:31PM +0200, Corinna Vinschen wrote:
>>> If we can't make it fail then I still think that the file should be
>>> created "up" the directory path, as close as you can get to Cygwin's
>>> notion of cwd.
>>So, "set it to the longest possible path prefix of Cygwin's cwd which is
>>still accepted by SetCurrentDirectory".
> Yes, but I still think it should be an error.

I agree, that would be ideal, and the fake drive letter is a very
clever idea. It needs to be fast though, as it will affect every
chdir() call where SetCurrentDirectory fails.

Regarding the alternative, I think cutting the path to fit MAX_PATH is
worse than either simply ignoring the failure (and hence leaving it in
the previous directory) or changing to a known and documented
directory. Cutting the path to length may be straightforward in code,
but it would be very awkward to work out manually. Also, repeated
SetCurrentDirectory calls with shorter and shorter paths would be
needed if the failure is due to missing privileges rather than an
overlong PATH.

As for going to a known location, the Cygwin root seems the best of a
bad bunch so far. GetWindowsDirectory()\Temp might be another
possibility, but I don't know whether that's guaranteed to exist.
Simply ignoring the SetCurrentDirectory() failure suddenly seems quite
tempting. At least it's fast.


More information about the Cygwin-developers mailing list