From: Jeff King <peff@peff.net>
To: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Cc: "Duy Nguyen" <pclouds@gmail.com>,
"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
git@vger.kernel.org, "Kevin Willford" <kewillf@microsoft.com>
Subject: Re: [BUG] index corruption with git commit -p
Date: Sun, 2 Sep 2018 04:02:06 -0400 [thread overview]
Message-ID: <20180902080205.GD18787@sigill.intra.peff.net> (raw)
In-Reply-To: <20180902075351.lkfnekklnwot7lzf@ltop.local>
On Sun, Sep 02, 2018 at 09:53:53AM +0200, Luc Van Oostenryck wrote:
> > At any rate, I think this perfectly explains the behavior we're seeing.
>
> Yes, this certainly make sense.
>
> For fun (and testing) I tried to take the problem in the other direction:
> * why hasn't this be detected earlier (I'm reasonably be sure I did the
> same operation a few times already without seeing the corruption)?
> * how easy it is to reproduce the problem?
> * Is it enough to do an interactive commit with nothing needing interactive?
>
> So I tried the following and some variants:
> > for i in $(seq -w 0 100); do echo $i > f$i; done
> > git add f* && git commit -m add f* && git rm -q f* && git commit -m rm -p
>
> but I didn't succeed to recreate the problem. So I'm still wondering
> what is special in my repository & tree that trigger the corruption.
I think the partial deletion is important, because it means that the
resulting index is going to be smaller. And the truncation problem only
matters when we go from a larger file to a smaller one (since otherwise
overwrite the old content completely).
And it doesn't seem to trigger without the interactive "-p". I think
that's not directly related, but it somehow triggers the case where we
actually need to update the cache tree in this particular order.
That's pretty hand-wavy, but I think it gives a sense of why most people
didn't run into this. I do wish I understood better what it would take
to create a minimal example for the test suite.
-Peff
next prev parent reply other threads:[~2018-09-02 8:02 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-01 21:41 [BUG] index corruption with git commit -p Luc Van Oostenryck
2018-09-01 22:17 ` Ævar Arnfjörð Bjarmason
2018-09-02 5:08 ` Jeff King
2018-09-02 7:12 ` Duy Nguyen
2018-09-02 7:24 ` Jeff King
2018-09-02 7:53 ` Luc Van Oostenryck
2018-09-02 8:02 ` Jeff King [this message]
2018-09-04 15:57 ` Junio C Hamano
2018-09-04 16:13 ` Duy Nguyen
2018-09-04 16:38 ` Jeff King
2018-09-04 23:36 ` [PATCH] reopen_tempfile(): truncate opened file Jeff King
2018-09-05 15:27 ` Duy Nguyen
2018-09-05 15:35 ` Jeff King
2018-09-05 15:39 ` Duy Nguyen
2018-09-05 15:48 ` Jeff King
2018-09-05 16:54 ` Junio C Hamano
2018-09-05 16:56 ` Jeff King
2018-09-05 17:01 ` Junio C Hamano
2018-09-05 18:48 ` Luc Van Oostenryck
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=20180902080205.GD18787@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=kewillf@microsoft.com \
--cc=luc.vanoostenryck@gmail.com \
--cc=pclouds@gmail.com \
/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).