Bug: combined diff with --ignore-matching-lines
- From
René Scharfe <l.s.r@web.de>
- Date
- May 14, 2022, 09:32 UTC
- Message-ID
- <a6a14213-bc82-d6fb-43dd-5a423c40a4f8@web.de>
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.txtJust setting need_generic_pathscan is not enough. Ideas?
René