From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
Ben Lynn <benlynn@gmail.com>,
git@vger.kernel.org
Subject: Re: git bugs
Date: Fri, 13 Jun 2008 16:09:05 -0700 [thread overview]
Message-ID: <7vbq25j5ke.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <20080613101024.GA8221@sigill.intra.peff.net> (Jeff King's message of "Fri, 13 Jun 2008 06:10:24 -0400")
Jeff King <peff@peff.net> 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 &&
next prev parent reply other threads:[~2008-06-13 23:10 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-10 8:41 git bugs Ben Lynn
2008-06-10 16:58 ` Daniel Barkalow
2008-06-10 17:44 ` Linus Torvalds
2008-06-10 18:45 ` Ben Lynn
2008-06-10 20:06 ` Linus Torvalds
2008-06-10 23:09 ` Ben Lynn
2008-06-10 23:38 ` Junio C Hamano
2008-06-11 0:02 ` Ben Lynn
2008-06-11 0:20 ` Junio C Hamano
2008-06-11 0:24 ` Ben Lynn
2008-06-11 0:53 ` Ben Lynn
2008-06-11 12:46 ` Stephen R. van den Berg
2008-06-12 6:51 ` Ben Lynn
2008-06-11 1:36 ` Linus Torvalds
2008-06-11 2:04 ` Ben Lynn
2008-06-11 2:12 ` Linus Torvalds
2008-06-11 2:31 ` Ben Lynn
2008-06-11 2:39 ` Linus Torvalds
2008-06-11 5:58 ` Ben Lynn
2008-06-11 6:18 ` Ben Lynn
2008-06-11 14:54 ` Linus Torvalds
2008-06-11 17:52 ` Ben Lynn
2008-06-11 18:10 ` Linus Torvalds
2008-06-11 18:48 ` Ben Lynn
2008-06-11 18:53 ` Linus Torvalds
2008-06-11 20:57 ` Ben Lynn
2008-06-11 21:50 ` Junio C Hamano
2008-06-11 14:52 ` Linus Torvalds
2008-06-12 20:06 ` Junio C Hamano
2008-06-13 10:10 ` Jeff King
2008-06-13 23:09 ` Junio C Hamano [this message]
2008-06-14 6:25 ` Jeff King
2008-06-12 3:17 ` Shawn O. Pearce
2008-06-12 6:46 ` Ben Lynn
2008-06-12 7:12 ` Johannes Schindelin
-- strict thread matches above, loose matches on Subject: below --
2017-02-23 20:27 Sean Hunt
2017-02-24 16:52 ` Johannes Schindelin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7vbq25j5ke.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=benlynn@gmail.com \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).