From: "René Scharfe" <l.s.r@web.de> To: Git List <git@vger.kernel.org> Cc: "Junio C Hamano" <gitster@pobox.com>, "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>, "Michał Kępień" <michal@isc.org> Subject: Bug: combined diff with --ignore-matching-lines Date: Sat, 14 May 2022 11:32:31 +0200 [thread overview] Message-ID: <a6a14213-bc82-d6fb-43dd-5a423c40a4f8@web.de> (raw) Hi all, git diff segfaults when it's asked to produce a combined diff and ignore certain lines with --ignore-matching-lines/-I, e.g.: $ git diff -I DEF_VER v2.33.3 v2.33.3^@ zsh: segmentation fault ./git-diff -I DEF_VER v2.33.3 v2.33.3^@ That's because combine-diff.c::diff_tree_combined() copies a diffopt without making a deep copy of the ignore_regex array and frees it, then later tries to use it. The segfault can be fixed by adding "diffopt.no_free = 1;" or reverting c45dc9cf30 (diff: plug memory leak from regcomp() on {log,diff} -I, 2021-02-11). But even with that the only thing the command ignores is the option -I; the GIT-VERSION-GEN changes in the middle should have been omitted: $ git diff -I DEF_VER v2.33.3 v2.33.3^@ diff --cc Documentation/RelNotes/2.33.3.txt index 0000000000,0000000000..e2bada12a1 new file mode 100644 --- /dev/null +++ b/Documentation/RelNotes/2.33.3.txt @@@ -1,0 -1,0 +1,4 @@@ ++Git Documentation/RelNotes/2.33.3.txt Release Notes ++========================= ++ ++This release merges up the fixes that appear in v2.33.3. diff --cc GIT-VERSION-GEN index d81eab5f00,e7efe58866..86a3a2870c --- a/GIT-VERSION-GEN +++ b/GIT-VERSION-GEN @@@ -1,7 -1,7 +1,7 @@@ #!/bin/sh GVF=GIT-VERSION-FILE - DEF_VER=v2.33.2 -DEF_VER=v2.32.2 ++DEF_VER=v2.33.3 LF=' ' diff --cc RelNotes index 8e79de2efe,4ac68388c3..899139d9ec --- a/RelNotes +++ b/RelNotes @@@ -1,1 -1,1 +1,1 @@@ - Documentation/RelNotes/2.33.2.txt -Documentation/RelNotes/2.32.2.txt ++Documentation/RelNotes/2.33.3.txt Just setting need_generic_pathscan is not enough. Ideas? René
next reply other threads:[~2022-05-14 9:33 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-05-14 9:32 René Scharfe [this message] 2022-05-23 18:31 ` [PATCH] diff: fix a segfault in >2 tree -I<regex> and --output=<file> Ævar Arnfjörð Bjarmason 2022-05-23 20:08 ` Junio C Hamano 2022-05-24 11:38 ` Ævar Arnfjörð Bjarmason 2022-05-24 19:38 ` Junio C Hamano 2022-05-24 20:17 ` Ævar Arnfjörð Bjarmason 2022-06-18 11:12 ` René Scharfe 2022-06-18 11:12 ` [PATCH 1/2] combine-diff: abort if --ignore-matching-lines is given René Scharfe 2022-06-21 15:35 ` Junio C Hamano 2022-06-21 15:58 ` René Scharfe 2022-06-21 16:55 ` Junio C Hamano 2022-06-18 11:12 ` [PATCH 2/2] combine-diff: abort if --output " René Scharfe
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=a6a14213-bc82-d6fb-43dd-5a423c40a4f8@web.de \ --to=l.s.r@web.de \ --cc=avarab@gmail.com \ --cc=git@vger.kernel.org \ --cc=gitster@pobox.com \ --cc=michal@isc.org \ --subject='Re: Bug: combined diff with --ignore-matching-lines' \ /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
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).