Re: t0027 racy?
- From
Jeff King <peff@peff.net>
- Date
- Aug 9, 2016, 06:51 UTC
- Message-ID
- <20160809065110.GB17777@peff.net>
- In-Reply-To
- <20160808203224.GA28431@tb-raspi>
On Mon, Aug 08, 2016 at 08:32:24PM +0000, Torsten Bögershausen wrote:
Show 17 quoted lines
> > The verbose output is not very exciting, though:
> >
> > expecting success:
> > check_warning "$lfwarn" ${pfx}_LF.err
> >
> > --- NNO_attr_auto_aeol_crlf_false_LF.err.expect 2016-08-08 15:26:37.061701392 +0000
> > +++ NNO_attr_auto_aeol_crlf_false_LF.err.actual 2016-08-08 15:26:37.061701392 +0000
> > @@ -1 +0,0 @@
> > -warning: LF will be replaced by CRLF
> > not ok 114 - commit NNO files crlf=false attr=auto LF
> [...]
> The warning is missing, but should be there:
>
> The file has LF, and after commit and a new checkout these LF will
> be convertet into CRLF.
>
> So why isn't the warning there (but here on my oldish machines)To be clear, the warning _is_ there when I just run t0027 by itself, and the test passes. It's only under heavy load that it isn't. So it's a race condition either in the test script or in git itself.
Usually race conditions like these are due to one of:
- git dying from SIGPIPE before it has a chance to output the command.
But I don't see any pipes being used in the test script. - index raciness causing us to avoid reading file content. For
example, if you do: echo foo >bar
git add bar Then _usually_ "bar" and the index will have the same mtime. And
therefore subsequent commands that need to refresh the index will
re-read the content of "bar", because they cannot tell from the stat
information if we have the latest version of "bar" in the index or
not (it could have been written after the index update, but in the
same second). But on a slow or heavily loaded system (or if you simply get unlucky
in crossing the boundary to a new second), they'll have different
mtimes. And therefore git knows it can skip reading the content from
the filesystem. So if your test relies on git actually re-converting the file
content, it would sometimes randomly fail.The second one seems plausible, given the history of issues with changing CRLF settings for an existing checkout. I'm not sure if it would be feasible to reset the index completely before each tested command, but that would probably solve it.
-Peff