git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Possible timestamp problems with diff-files?
@ 2011-09-20 10:30 Marc Strapetz
  2011-09-20 17:54 ` Jeff King
  0 siblings, 1 reply; 5+ messages in thread
From: Marc Strapetz @ 2011-09-20 10:30 UTC (permalink / raw)
  To: git

For our Git client, we are invoking

git diff-files--quiet --ignore-submodules

immediately after a commit of *all* changes. Hence, the expected exit
code would be 0 (because there are no changes). A user has now reported
that for commits with many changes, exit code is sometimes 1. For the
last incident, the commit was started at 15:24:11,820 and finished at
15:24:12,329, diff-files was invoked at 15:24:12,455 and failed with
exit code 1 at 15:24:21,394. A subsequent diff-files succeeded, so I'm
wondering now, if that could be a timestamp problem (maybe related to
the Index)?

Note that there are a couple of threads running in the client itself, so
I guess actual running time of diff-files was much shorter than 9
seconds and chances are that some parts of diff-files were run in the
same second 15:24:12.

System configuration is:
Linux splitter 2.6.38-11-server #48-Ubuntu SMP Fri Jul 29 19:20:32 UTC
2011 x86_64 x86_64 x86_64 GNU/Linux

git version 1.7.4.1

--
Best regards,
Marc Strapetz
=============
syntevo GmbH
http://www.syntevo.com
http://blog.syntevo.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Possible timestamp problems with diff-files?
  2011-09-20 10:30 Possible timestamp problems with diff-files? Marc Strapetz
@ 2011-09-20 17:54 ` Jeff King
  2011-09-21 12:58   ` Marc Strapetz
  0 siblings, 1 reply; 5+ messages in thread
From: Jeff King @ 2011-09-20 17:54 UTC (permalink / raw)
  To: Marc Strapetz; +Cc: git

On Tue, Sep 20, 2011 at 12:30:53PM +0200, Marc Strapetz wrote:

> For our Git client, we are invoking
> 
> git diff-files--quiet --ignore-submodules
> 
> immediately after a commit of *all* changes. Hence, the expected exit
> code would be 0 (because there are no changes). A user has now reported
> that for commits with many changes, exit code is sometimes 1. For the
> last incident, the commit was started at 15:24:11,820 and finished at
> 15:24:12,329, diff-files was invoked at 15:24:12,455 and failed with
> exit code 1 at 15:24:21,394. A subsequent diff-files succeeded, so I'm
> wondering now, if that could be a timestamp problem (maybe related to
> the Index)?

diff-files is scriptable plumbing, which means it is up to the script
writer to decide exactly when the index should be refreshed with respect
to the working tree files (because doing so could be kind of expensive,
as it needs to stat every file in the working tree). Have you tried
running "git update-index --refresh" just before your diff-files?

-Peff

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Possible timestamp problems with diff-files?
  2011-09-20 17:54 ` Jeff King
@ 2011-09-21 12:58   ` Marc Strapetz
  2011-09-21 21:33     ` Junio C Hamano
  0 siblings, 1 reply; 5+ messages in thread
From: Marc Strapetz @ 2011-09-21 12:58 UTC (permalink / raw)
  To: Jeff King; +Cc: git

On 20.09.2011 19:54, Jeff King wrote:
> On Tue, Sep 20, 2011 at 12:30:53PM +0200, Marc Strapetz wrote:
> 
>> For our Git client, we are invoking
>>
>> git diff-files--quiet --ignore-submodules
>>
>> immediately after a commit of *all* changes. Hence, the expected exit
>> code would be 0 (because there are no changes). A user has now reported
>> that for commits with many changes, exit code is sometimes 1. For the
>> last incident, the commit was started at 15:24:11,820 and finished at
>> 15:24:12,329, diff-files was invoked at 15:24:12,455 and failed with
>> exit code 1 at 15:24:21,394. A subsequent diff-files succeeded, so I'm
>> wondering now, if that could be a timestamp problem (maybe related to
>> the Index)?
> 
> diff-files is scriptable plumbing, which means it is up to the script
> writer to decide exactly when the index should be refreshed with respect
> to the working tree files (because doing so could be kind of expensive,
> as it needs to stat every file in the working tree). Have you tried
> running "git update-index --refresh" just before your diff-files?

My point is that "git diff-files --quiet" seems to returns 1 and when
invoked a short time later (without modifying working tree or invoking
any other Git command) it returns 0. This would indicate a bug in Git, I
guess. I think we can add more debug logging to our client to track down
that problem. However, to do that I'd need some input on what to log?

--
Best regards,
Marc Strapetz
=============
syntevo GmbH
http://www.syntevo.com
http://blog.syntevo.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Possible timestamp problems with diff-files?
  2011-09-21 12:58   ` Marc Strapetz
@ 2011-09-21 21:33     ` Junio C Hamano
  2011-09-24 14:30       ` Robin Rosenberg
  0 siblings, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2011-09-21 21:33 UTC (permalink / raw)
  To: Marc Strapetz; +Cc: Jeff King, git

Marc Strapetz <marc.strapetz@syntevo.com> writes:

> On 20.09.2011 19:54, Jeff King wrote:
>> On Tue, Sep 20, 2011 at 12:30:53PM +0200, Marc Strapetz wrote:
>> 
>>> For our Git client, we are invoking
>>>
>>> git diff-files--quiet --ignore-submodules
>>>
>>> immediately after a commit of *all* changes. Hence, the expected exit
>>> code would be 0 (because there are no changes). A user has now reported
>>> that for commits with many changes, exit code is sometimes 1. For the
>>> last incident, the commit was started at 15:24:11,820 and finished at
>>> 15:24:12,329, diff-files was invoked at 15:24:12,455 and failed with
>>> exit code 1 at 15:24:21,394. A subsequent diff-files succeeded, so I'm
>>> wondering now, if that could be a timestamp problem (maybe related to
>>> the Index)?

What peff said already.

If you do not refresh the cached stat information, diff-files may report
"they differ" for a path that is otherwise unchanged without looking at
the contents of such a path to notice that the only difference is the
cached stat information (the whole and only point of having the cached
stat information is to avoid looking at the contents). Also, it may look
at the contents of such a path if it has a reason to suspect that the file
might have changed if it cannot tell from the cached stat information
(look for "racy-git" if you are really interested).

Update the cached stat information before you use plumbing commands in
your script.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Possible timestamp problems with diff-files?
  2011-09-21 21:33     ` Junio C Hamano
@ 2011-09-24 14:30       ` Robin Rosenberg
  0 siblings, 0 replies; 5+ messages in thread
From: Robin Rosenberg @ 2011-09-24 14:30 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Marc Strapetz, Jeff King, git

Junio C Hamano skrev 2011-09-21 23.33:
> Marc Strapetz<marc.strapetz@syntevo.com>  writes:
>
>> On 20.09.2011 19:54, Jeff King wrote:
>>> On Tue, Sep 20, 2011 at 12:30:53PM +0200, Marc Strapetz wrote:
>>>
>>>> For our Git client, we are invoking
>>>>
>>>> git diff-files--quiet --ignore-submodules
>>>>
>>>> immediately after a commit of *all* changes. Hence, the expected exit
>>>> code would be 0 (because there are no changes). A user has now reported
>>>> that for commits with many changes, exit code is sometimes 1. For the
>>>> last incident, the commit was started at 15:24:11,820 and finished at
>>>> 15:24:12,329, diff-files was invoked at 15:24:12,455 and failed with
>>>> exit code 1 at 15:24:21,394. A subsequent diff-files succeeded, so I'm
>>>> wondering now, if that could be a timestamp problem (maybe related to
>>>> the Index)?
>
> What peff said already.
>
> If you do not refresh the cached stat information, diff-files may report
> "they differ" for a path that is otherwise unchanged without looking at
> the contents of such a path to notice that the only difference is the
> cached stat information (the whole and only point of having the cached
> stat information is to avoid looking at the contents). Also, it may look
> at the contents of such a path if it has a reason to suspect that the file
> might have changed if it cannot tell from the cached stat information
> (look for "racy-git" if you are really interested).
>
> Update the cached stat information before you use plumbing commands in
> your script.

Using git diff instead of git diff-files would do just that, unless I am
missing something.

-- robin

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-09-24 14:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-20 10:30 Possible timestamp problems with diff-files? Marc Strapetz
2011-09-20 17:54 ` Jeff King
2011-09-21 12:58   ` Marc Strapetz
2011-09-21 21:33     ` Junio C Hamano
2011-09-24 14:30       ` Robin Rosenberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).