From: Junio C Hamano <gitster@pobox.com>
To: "Martin Ågren" <martin.agren@gmail.com>
Cc: Joey Hess <id@joeyh.name>,
git@vger.kernel.org, Tao Klerks <tao@klerks.biz>
Subject: Re: git write-tree segfault with core.untrackedCache true and nonexistent index
Date: Fri, 22 Jul 2022 12:41:01 -0700 [thread overview]
Message-ID: <xmqq35etc4vm.fsf@gitster.g> (raw)
In-Reply-To: <20220722192559.718264-1-martin.agren@gmail.com> ("Martin Ågren"'s message of "Fri, 22 Jul 2022 21:25:59 +0200")
Martin Ågren <martin.agren@gmail.com> writes:
> I can't help but think that e6a653554b was just unlucky enough to
> dereference `istate->repo` and that the real issue is that we're missing
>
> if (!istate->repo)
> istate->repo = the_repository;
>
> in some strategic place a fair bit earlier. It seems to me like the diff
> below is just papering over the real bug. It's not obvious to me where
> that check would want to go, though. Tao, do you have an idea?
I am not Tao, but thanks for starting to analyze the real issue.
It seems that there are two public entry points to dir.c API that
end up calling new_untracked_cache_flags().
One is read_directory(), which is the only caller of
validate_untracked_cache() that calls new_untracked_cache_flags().
The callers of read_directory() are supposed to give istate, and it
is quite unlikely they are throwing an istate with NULL in
istate->repo, simply because read_directory() already makes abundant
use of istate->repo.
The other one is add_untracked_cache().
Perhaps backtrace to see where the istate came from would quickly
reveal where the real issue lies?
Thanks.
next prev parent reply other threads:[~2022-07-22 19:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-22 17:24 git write-tree segfault with core.untrackedCache true and nonexistent index Joey Hess
2022-07-22 19:25 ` Martin Ågren
2022-07-22 19:41 ` Junio C Hamano [this message]
2022-07-22 21:22 ` [PATCH] read-cache: make `do_read_index()` always set up `istate->repo` Martin Ågren
2022-07-22 21:46 ` Junio C Hamano
2022-07-22 22:00 ` Martin Ågren
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=xmqq35etc4vm.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=id@joeyh.name \
--cc=martin.agren@gmail.com \
--cc=tao@klerks.biz \
/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).