From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: Wilfred Hughes <me@wilfred.me.uk>, git@vger.kernel.org
Subject: Re: [PATCH] diff: handle NULL meta-info when spawning external diff
Date: Mon, 29 Jan 2024 10:37:29 -0800 [thread overview]
Message-ID: <xmqqede0htp2.fsf@gitster.g> (raw)
In-Reply-To: <20240129015708.GA1762343@coredump.intra.peff.net> (Jeff King's message of "Sun, 28 Jan 2024 20:57:08 -0500")
Jeff King <peff@peff.net> writes:
>> $ git diff --no-index foo bar
>> zsh: segmentation fault (core dumped) git diff --no-index foo bar
>
> Thanks for providing a simple reproduction recipe. There's a pretty
> straight-forward fix below, though it leaves open some question of
> whether there's another bug lurking with --no-index (but either way, I
> think we'd want this simple fix as a first step).
Yup, I agree with you that the "--no-index" mode violates the basic
design that "the other path" and "xfrm_msg" go hand-in-hand. In its
two tree comparison mode "git diff --no-index A/ B/", it should be
able to behave sensibly, but in its two files comparison mode to
compare plain regular files 'foo' and 'bar', there is nothing it can
do reasonably, I am afraid. You could say that the change is
renaming 'foo' to create 'bar', and feed consistent data that is
aligned with that rename to external diff, which might be slightly
more logical than showing a change to 'foo' that has no rename
involved (i.e. omitting "other name"), but neither is satisfying.
> But I'm not sure what fallout we might have from changing that behavior
> now. So this patch takes the less-risky option, and simply teaches
> run_external_diff() to avoid passing xfrm_msg when it's NULL. That makes
> it agnostic to whether "other" and "xfrm_msg" always come as a pair. It
> fixes the segfault now, and if we want to change the --no-index "other"
> behavior on top, it will handle that, too.
Sounds sensible.
Thanks. Will queue.
next prev parent reply other threads:[~2024-01-29 18:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-28 20:24 Git segfaults with diff.external and comparing files with different permissions Wilfred Hughes
2024-01-29 1:57 ` [PATCH] diff: handle NULL meta-info when spawning external diff Jeff King
2024-01-29 18:37 ` Junio C Hamano [this message]
2024-01-30 6:06 ` Jeff King
2024-01-30 16:29 ` Junio C Hamano
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=xmqqede0htp2.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=me@wilfred.me.uk \
--cc=peff@peff.net \
/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).