Subject: Re: [RFC/PATCH v2 1/1] cygwin: Add fast_lstat() and fast_fstat() functions

From: Mark Levedahl <[email-masked]>
Date: Sun, 14 Jul 2013 12:15:19 -0400

On 07/10/2013 04:23 PM, Ramsay Jones wrote:
> Commit adbc0b6b ("cygwin: Use native Win32 API for stat", 30-09-2008)
> added a Win32 specific implementation of the stat functions. In order
> to handle absolute paths, cygwin mount points and symbolic links, this
> implementation may fall back on the standard cygwin l/stat() functions.
> Also, the choice of cygwin or Win32 functions is made lazily (by the
> first call(s) to l/stat) based on the state of some config variables.
>
> Unfortunately, this "schizophrenic stat" implementation has been the
> source of many problems ever since. For example, see commits 7faee6b8,
> 79748439, 452993c2, 085479e7, b8a97333, 924aaf3e, 05bab3ea and 0117c2f0.
>
> In order to limit the adverse effects caused by this implementation,
> we provide a new "fast stat" interface, which allows us to use this
> only for interactions with the index (i.e. the cached stat data).
>
> Signed-off-by: Ramsay Jones <[email-masked]>
> ---

I've tested this on Cygwin 1.7 on WIndows 7 , comparing to the results 
using your prior patch (removing the Cygwin specific lstat entirely) and 
get the same results with both, so this seems ok from me.

My comparison point was created by reverting your current patch from pu, 
then reapplying your earlier patch on top, so the only difference was 
which approach was used to address the stat functions.

Caveats:
1) I don't find any speed improvement of the current patch over the 
previous one (the tests actually ran faster with the earlier patch, 
though the difference was less than 1%).
2) I still question this whole approach, especially having this 
non-POSIX compliant mode be the default. Running in this mode breaks 
interoperability with Linux, but providing a Linux environment is the 
*primary* goal of Cygwin.

Mark