Version: 3.4 (using KDE 3.5.5, Debian Package 4:3.5.5a.dfsg.1-5 (4.0)) Imported bug from http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=358853 when reading a unified diff file that comprises diffs to more than one file, kompare fails to decode it correctly when the leading "diff ...." line is not given. Examples: --- empty1.txt 2006-03-24 20:03:07.000000000 +0100 +++ text1.txt 2006-03-24 20:02:00.000000000 +0100 @@ -0,0 +1 @@ +just a little text --- empty2.txt 2006-03-24 20:03:07.000000000 +0100 +++ text2.txt 2006-03-24 20:02:22.000000000 +0100 @@ -0,0 +1 @@ +and another text fails while diff -ub empty1.txt text1.txt --- empty1.txt 2006-03-24 20:03:07.000000000 +0100 +++ text1.txt 2006-03-24 20:02:00.000000000 +0100 @@ -0,0 +1 @@ +just a little text diff -ub empty2.txt text2.txt --- empty2.txt 2006-03-24 20:03:07.000000000 +0100 +++ text2.txt 2006-03-24 20:02:22.000000000 +0100 @@ -0,0 +1 @@ +and another text works.
Created attachment 19030 [details] patch This patch forces the parsing to consider unified header line not to be part of remove/add lines.
I have applied the patch to latest Debian packages(3.5.8). It works. This means that https://bugs.kde.org/show_bug.cgi?id=152366 is a dupe of this one.
SVN commit 938013 by bruggie: BUG: 139209 This is the best approach to fixing this bug. Thanks to Olivier Trichet for supplying the patch 2 years and almost 3 months ago :(. Sorry for this incredible long time. M +3 -1 parserbase.cpp WebSVN link: http://websvn.kde.org/?view=rev&revision=938013
SVN commit 944068 by kkofler: CCBUG: 139209 This is the best approach to fixing this bug. Thanks to Olivier Trichet for supplying the patch 2 years and almost 3 months ago :(. Sorry for this incredible long time. Backport revision 938013 by bruggie from trunk. M +3 -1 parserbase.cpp WebSVN link: http://websvn.kde.org/?view=rev&revision=944068
that patch is _not_ the way to fix this bug. the patch has introduced bug 208688, which is (in my estimation) significantly worse. The parser needs to respect the line counts in the diff header instead to avoid reading a diff header as diff content. https://bugs.kde.org/show_bug.cgi?id=208688 reverting fix, reopening.
SVN commit 1028512 by je4d: Revert the fix for bug 139209 - the fix used caused bug 208688. 139209 needs to be fixed by counting lines instead. BUG:208688 CCBUG:139209 M +1 -3 parserbase.cpp WebSVN link: http://websvn.kde.org/?view=rev&revision=1028512
SVN commit 1028515 by je4d: track line counts so that we don't interpret a diff header (--- file...) as a removal if there's nothing separating it from the last hunk of the previous diff. BUG: 139209 M +23 -16 parserbase.cpp WebSVN link: http://websvn.kde.org/?view=rev&revision=1028515
SVN commit 1028516 by je4d: port bugfix from trunk: track line counts so that we don't interpret a diff header (--- file...) as a removal if there's nothing separating it from the last hunk of the previous diff. BUG: 139209 M +26 -12 parserbase.cpp WebSVN link: http://websvn.kde.org/?view=rev&revision=1028516
SVN commit 1028719 by kkofler: Revert the fix for bug 139209 - the fix used caused bug 208688. 139209 needs to be fixed by counting lines instead. CCBUG:208688 CCBUG:139209 backport revision 1028512 by je4d from trunk M +1 -3 parserbase.cpp WebSVN link: http://websvn.kde.org/?view=rev&revision=1028719
SVN commit 1028720 by kkofler: track line counts so that we don't interpret a diff header (--- file...) as a removal if there's nothing separating it from the last hunk of the previous diff. CCBUG: 139209 (The correct fix for #139209, which hopefully doesn't cause regressions.) backport revision 1028515 by je4d from trunk M +23 -16 parserbase.cpp WebSVN link: http://websvn.kde.org/?view=rev&revision=1028720
There is a bug in the patch: lineCountA is assigned instead of lineCountB for the destination line count. This would cause a diff like this to fail to parse correctly: --- foo 2009-10-11 13:41:51.000000000 +0100 +++ bar 2009-10-11 13:41:57.000000000 +0100 @@ -1,7 +1,2 @@ a -b -c -d -e -f g The parsing ends prematurely since there are more deletions than insertions, and kompare only shows the line with 'b' as deleted. I'm attaching a patch to correct this.
Created attachment 37509 [details] Correction for r1028720 and r1028515
Whoops, thanks for spotting this, will apply ASAP.
SVN commit 1033954 by kkofler: Fix typo spotted by Will Angenent (4.3.2 regression). CCBUG: 139209 M +1 -1 parserbase.cpp WebSVN link: http://websvn.kde.org/?view=rev&revision=1033954
SVN commit 1033955 by kkofler: Fix typo spotted by Will Angenent (4.3.2 regression). CCBUG: 139209 backport revision 1033954 from trunk M +1 -1 parserbase.cpp WebSVN link: http://websvn.kde.org/?view=rev&revision=1033955
Fixed in trunk and 4.3 branch, the fix will be in 4.3.3. Fixed Fedora packages (kdesdk-4.3.2-2.fc13, kdesdk-4.3.2-2.fc12, kdesdk-4.3.2-2.fc11, kdesdk-4.3.2-2.fc10) now building. Distros are strongly encouraged to apply the fix ASAP. Thanks again!