Re: [PATCH 2/2] Windows: Skip fstat/lstat optimization in write_entry()
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Apr 20, 2009, 21:17 UTC
- Message-ID
- <7vbpqrdnyn.fsf@gitster.siamese.dyndns.org>
- In-Reply-To
- <20090420133305.GE25059@dpotapov.dyndns.org>
Dmitry Potapov <dpotapov@gmail.com> writes:
Show 19 quoted lines
> On Mon, Apr 20, 2009 at 02:58:49PM +0200, Alex Riesen wrote: >> 2009/4/20 Dmitry Potapov <dpotapov@gmail.com>: >> > The cygwin version has the same problem. (In fact, it is even worse, >> > because we have an optimized version for lstat/stat but not for fstat, >> > and they return different values for some fields like i_no). But even >> > if we used the only Cygwin functions, we would still face the problem, >> > because Windows returns the wrong values for timestamps (and maybe >> > even size on FAT?). So I think the following patch should be squashed >> > on top. >> >> I just sent a patch with an "optimized" fstat. I see no problems (at least none >> like these) with that patch. Timestamps match. Windows XP, yes. But since >> that MSDN article mentions that it is not guaranteed, I guess I just been lucky. > > If the time passed between the creating file and end of writing to it is > small (less than timestamp resolution), you may not notice the problem. > The following program demonstrates the problem with fstat on Windows. > (I compiled it using Cygwin). If you remove 'sleep' then you may not > notice the problem for a long time.
I take that you mean that Alex's patch does not work as intended. In the meantime, I've squashed your one-liner "Cygwin-too" into Hannes's patch.
Thanks.