Jeff King <peff@xxxxxxxx> writes: > On Tue, Jun 10, 2008 at 10:44:43AM -0700, Linus Torvalds wrote: > >> You can fix this multiple ways. One would be to pick another size that is >> simply less likely (eg ~0 instead), which leaves the theoretical race, and >> just makes it practically impossible to hit (not that I think it's very >> practical to hit already). > > Hmm. I may have just hit it in the test suite. > > Try this: > > cd git/t > for i in `seq 1 1000`; do > ./t4126-apply-empty.sh -v -i || break > done > echo made it to $i > > Most of the time it works, but somewhere in that thousand (generally > within a few hundred), I end up with a failed test. > ... > However, I can still trigger the failure with your patch, so I wonder if > it is some other race entirely... This is not a race but the test itself is simply buggy. When telling apply to affect index and work tree at the same time (that is what --index means), the caller must make sure that the diff-files won't report stale stat information. If "git reset --hard" and ">empty" crossed the second boundary, the reset might have written out an empty "empty" with timestamp T and then the independent ">empty" would have given a new timestamp T+1. I think "reset --hard" without ">empty" is enough as the head commit records an empty blob there. --- t/t4126-apply-empty.sh | 4 ---- 1 files changed, 0 insertions(+), 4 deletions(-) diff --git a/t/t4126-apply-empty.sh b/t/t4126-apply-empty.sh index 0cfd47c..ceb6a79 100755 --- a/t/t4126-apply-empty.sh +++ b/t/t4126-apply-empty.sh @@ -26,7 +26,6 @@ test_expect_success setup ' test_expect_success 'apply empty' ' git reset --hard && - >empty && rm -f missing && git apply patch0 && test_cmp expect empty @@ -34,7 +33,6 @@ test_expect_success 'apply empty' ' test_expect_success 'apply --index empty' ' git reset --hard && - >empty && rm -f missing && git apply --index patch0 && test_cmp expect empty && @@ -43,7 +41,6 @@ test_expect_success 'apply --index empty' ' test_expect_success 'apply create' ' git reset --hard && - >empty && rm -f missing && git apply patch1 && test_cmp expect missing @@ -51,7 +48,6 @@ test_expect_success 'apply create' ' test_expect_success 'apply --index create' ' git reset --hard && - >empty && rm -f missing && git apply --index patch1 && test_cmp expect missing && -- 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