stat matters

Pierre A. Humblet Pierre.Humblet@ieee.org
Wed May 28 12:37:00 GMT 2003


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.

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?

3) GetCompressedFileSize does not always report the updated size between the
   moment where a write occurs and the moment where the buffers are flushed to
   disk. It can underreport the value of st_blocks, but it's not clear if this
   violates POSIX: 
   
   blkcnt_t  st_blocks  number of blocks allocated for this object

   Allocated where? The blocks won't be on disk until flushed.

Pierre



More information about the Cygwin-developers mailing list