From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Jeff King <peff@peff.net>
Cc: Junio C Hamano <gitster@pobox.com>,
git@vger.kernel.org,
Christophe Macabiau <christophemacabiau@gmail.com>
Subject: Re: fatal error when diffing changed symlinks
Date: Sat, 25 Feb 2017 13:36:58 +0100 (CET) [thread overview]
Message-ID: <alpine.DEB.2.20.1702251336420.3767@virtualbox> (raw)
In-Reply-To: <20170224203523.mdoh4ivhwflmpr6j@sigill.intra.peff.net>
Hi Peff & Junio,
On Fri, 24 Feb 2017, Jeff King wrote:
> On Fri, Feb 24, 2017 at 11:51:22AM -0800, Junio C Hamano wrote:
>
> > > A slightly worse is that the upcoming Git will ship with a rewritten
> > > "difftool" that makes the above sequence segfault.
> >
> > The culprit seems to be these lines in run_dir_diff():
> >
> > if (S_ISLNK(lmode)) {
> > char *content = read_sha1_file(loid.hash, &type, &size);
> > add_left_or_right(&symlinks2, src_path, content, 0);
> > free(content);
> > }
> >
> > if (S_ISLNK(rmode)) {
> > char *content = read_sha1_file(roid.hash, &type, &size);
> > add_left_or_right(&symlinks2, dst_path, content, 1);
> > free(content);
> > }
> >
> > When viewing a working tree file, oid.hash could be 0{40} and
> > read_sha1_file() is not the right function to use to obtain the
> > contents.
> >
> > Both of these two need to pay attention to 0{40}, I think, as the
> > user may be running "difftool -R --dir-diff" in which case the
> > working tree would appear in the left hand side instead.
>
> As a side note, I think even outside of 0{40}, this should be checking
> the return value of read_sha1_file(). A corrupted repo should die(), not
> segfault.
I agree. I am on it.
Ciao,
Dscho
next prev parent reply other threads:[~2017-02-25 12:38 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-24 11:47 fatal error when diffing changed symlinks Christophe Macabiau
2017-02-24 17:53 ` Junio C Hamano
2017-02-24 19:51 ` Junio C Hamano
2017-02-24 20:35 ` Jeff King
2017-02-25 12:36 ` Johannes Schindelin [this message]
2017-03-07 18:16 ` Junio C Hamano
2017-03-07 22:34 ` Johannes Schindelin
2017-03-13 17:56 ` [PATCH] difftool: handle changing symlinks in dir-diff mode David Aguilar
2017-03-13 18:32 ` Junio C Hamano
2017-03-13 21:04 ` Johannes Schindelin
2017-03-13 21:27 ` Johannes Schindelin
2017-03-13 21:33 ` Junio C Hamano
2017-03-14 2:20 ` David Aguilar
2017-03-14 5:52 ` Junio C Hamano
2017-03-14 4:13 ` Junio C Hamano
2017-03-13 19:02 ` Junio C Hamano
2017-03-13 21:36 ` 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=alpine.DEB.2.20.1702251336420.3767@virtualbox \
--to=johannes.schindelin@gmx.de \
--cc=christophemacabiau@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--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).