Re: Implementing stat() with FindFirstFile()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Samstag, 21. März 2009, Magnus Bäck wrote:
> Is there any reason why compat/win32.h uses GetFileAttributesEx()
> instead of FindFirstFile() to implement the stat() call on Windows?
> The current implementation requires each queried file to be opened
> and closed while FindFirstFile() only reads the directory.

There is: File times are extremely important for git. Unfortunately, MS's 
implementation of stat and utime are broken, and they do use FindFirstFile(). 
Read up on the topic here:

http://search.cpan.org/~shay/Win32-UTCFileTime-1.50/lib/Win32/UTCFileTime.pm

To quote the important sentence:

"The problem with Microsoft's stat(2) and utime(2) [...] is basically this: 
file times reported by stat(2) or stored by utime(2) may change by an hour as 
we move into or out of daylight saving time (DST) if the computer is set 
to "Automatically adjust clock for daylight saving changes" [...]."

Be sure to read section "Background Reference".

Besides that, our stat() implementation is already ca. twice as fast as 
MSVCRT's stat(). (Thank you, Marius!)

-- Hannes
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux