git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [RFH] Spurious failures of t0025.[34]

From
Thomas Rast <trast@student.ethz.ch>
Date
Jul 30, 2010, 22:47 UTC
Message-ID
<201007310047.46206.trast@student.ethz.ch>
In-Reply-To
<20100730182532.GB18544@coredump.intra.peff.net>
Jeff King wrote:
Show 5 quoted lines
> which dumped me with a shell in the "broken" state. The interesting
> thing is that I can then repeatably run "git diff two" and get an empty
> diff.  So I don't think the error or race condition is in the run of
> "git diff" itself, but rather what happened above (presumably the in
> the read-tree step).

This, and Jonathan's observation about git-apply, finally got me somewhere. The issue is that the index file has a timestamp different from the saved mtimes of the file itself. This can be provoked deterministically by the patch below, even without valgrind; valgrind merely makes it much more likely to happen by slowing down git-read-tree.

Now I don't know what the next step in the chain is. Who's the resident expert on index raciness? Does git-diff then reindex the file, and in doing so, change the index entry?

diff --git i/t/t0025-crlf-auto.sh w/t/t0025-crlf-auto.sh
index f5f67a6..7a9cd3a 100755
--- i/t/t0025-crlf-auto.sh
+++ w/t/t0025-crlf-auto.sh
@@ -46,6 +46,8 @@ test_expect_success 'crlf=true causes a CRLF file to be normalized' '
 	echo "two crlf" > .gitattributes &&
 	git read-tree --reset -u HEAD &&
 
+	test-chmtime +1 .git/index &&
+
 	# Note, "normalized" means that git will normalize it if added
 	has_cr two &&
 	twodiff=`git diff two` &&
@@ -58,6 +60,8 @@ test_expect_success 'text=true causes a CRLF file to be normalized' '
 	echo "two text" > .gitattributes &&
 	git read-tree --reset -u HEAD &&
 
+	test-chmtime +1 .git/index &&
+
 	# Note, "normalized" means that git will normalize it if added
 	has_cr two &&
 	twodiff=`git diff two` &&
-- 
Thomas Rast
trast@{inf,student}.ethz.ch
Previous: Jeff KingNext: Thomas Rast
Message 3 of 4 in “[RFH] Spurious failures of t0025.[34]”
  1. Thomas RastJul 29, 2010
  2. Jeff KingJul 30, 2010
  3. Thomas RastJul 30, 2010
  4. Thomas RastAug 5, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.