From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Cc: git@vger.kernel.org, Kevin Willford <kewillf@microsoft.com>
Subject: Re: [BUG] index corruption with git commit -p
Date: Sun, 02 Sep 2018 00:17:53 +0200 [thread overview]
Message-ID: <87tvn8c166.fsf@evledraar.gmail.com> (raw)
In-Reply-To: <20180901214157.hxlqmbz3fds7hsdl@ltop.local>
On Sat, Sep 01 2018, Luc Van Oostenryck wrote:
> Hi,
>
> I've just had a scary error:
> error: index uses $?+? extension, which we do not understand
> fatal: index file corrupt
>
> Things were quickly recovered by deleting the index but it clearly
> looks to a but to me.
>
> Here are the steps to reproduce it:
> $ git clone git://github.com/lucvoo/sparse-dev.git <somedir>
> $ cd <somedir>
> $ git co index-corruption
> $ git rm -r validation/ Documentation/
> $ git commit -m <some message> -p
> $ git status
> error: index uses $?+? extension, which we do not understand
> fatal: index file corrupt
>
>
> The 'extension' pattern '$?+?', can vary a bit, sometimes
> it's just '????', but always seems 4 chars.
> If the commit command doesn't use the '-p' flag, there is no
> problem. The repository itself is not corrupted, it's only
> the index. It happends with git 2.18.0 and 2.17.0
Yeah this is a bug, I didn't dig much but testing with this script down
to 2.8.0:
#!/bin/sh
cd ~/g/git
make -j $(parallel --number-of-cores) USE_LIBPCRE2=YesPlease CFLAGS="-O0 -g -ggdb3" DEVELOPER=1 DEVOPTS=no-error NO_OPENSSL=Y all
(
rm -rf /tmp/x;
~/g/git/git --exec-path=/home/avar/g/git clone git://github.com/lucvoo/sparse-dev.git /tmp/x &&
cd /tmp/x &&
~/g/git/git --exec-path=/home/avar/g/git checkout index-corruption &&
~/g/git/git --exec-path=/home/avar/g/git rm -r validation/ Documentation/ &&
~/g/git/git --exec-path=/home/avar/g/git commit -p
)
~/g/git/git --exec-path=/home/avar/g/git -C /tmp/x status
if ~/g/git/git --exec-path=/home/avar/g/git -C /tmp/x status
then
exit 0
else
exit 1
fi
I found that the first bad commit was: 680ee550d7 ("commit: skip
discarding the index if there is no pre-commit hook", 2017-08-14)
Now, note the two invocations of "status" in my script. Before we'd
already been complaining about a bad index, but after that commit is the
first time we started getting a persistent error, and indeed even
reverting it now on top of master makes the error non-persistent.
So not a fix, but a strong signal to see where we should start
looking. I.e. the index file handling around discard_cache() &
"interactive" in commit.c is likely what's broken.
next prev parent reply other threads:[~2018-09-01 22:18 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 [this message]
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
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87tvn8c166.fsf@evledraar.gmail.com \
--to=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=kewillf@microsoft.com \
--cc=luc.vanoostenryck@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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).