This is the mail archive of the cygwin-developers@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: stat matters


On Tue, May 27, 2003 at 07:48:43PM -0400, Pierre A. Humblet wrote:
>Here are three remarks about stat
>
>1) Yesterday there was a discussion in cygwin_patches about the use of
>strlen()
>   in fstat_by_name.
>   The good news is that we can use strcmp(a, b) <= 0 after all, because in our
>   case a is a prefix of b, or b is a prefix of a.
>   The bad news is that one old bug still isn't taken care of: "c:/." is
>   a root dir without being a prefix of "c:/".
>   So I suggest a more radical approach: do not check for root dir at all but
>   whenever FindFirstFile fails with winerror 2 (although we know the 
>   file did exist a few ms ago and we have its attributes), call fstat_helper 
>   with zero dates and lengths.

I guess this is the best approach.  Want to work up a patch?

>2) There is a comment in fhandler_disk_file::fstat to the effect that a 
>   "query open" is much faster than a normal open.
>   So, why don't we do a query open when possible, i.e. also for dirs, sockets,
>   symlinks, and more importantly, whenever has_acls(), ntsec and
>   wincap.has_security () are true?

This is supposed to be caught for anything which opens a file like
sockets or symlinks.  The other cases are not caught, though.  I'll add
something to path.cc to handle this.

cgf


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]