Summary: | kompare has troubles parsing certain unified diff output | ||
---|---|---|---|
Product: | [Applications] kompare | Reporter: | Markus Schöpflin <markus.schoepflin> |
Component: | general | Assignee: | Kompare developers <kompare-devel> |
Status: | RESOLVED DUPLICATE | ||
Severity: | normal | CC: | bruggie, markus.schoepflin |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Ubuntu | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Attachments: | Fix parsing of unified diffs |
Description
Markus Schöpflin
2009-08-18 10:56:21 UTC
Please note that this report is actually for KDE 4.2.2 for which I couldn't file a bug. As I have no means to try it with a more recent version of KDE, someone would need to verify if it is indeed broken on 4.2.4. It almost certainly is, we didn't do anything to fix it in the 4.2 branch before 4.2.4 or in the 4.3 branch before 4.3.0 (nor is this fixed in the current 4.3 branch or trunk as far as I know). I had a look at the sources for kompare. The problem seems to be that ParserBase::parseUnifiedHunkBody() stops reading the hunk body as soon as it finds a line matching m_unifiedDiffHeader1 (e.g. '--- blahblah'). This happens because ParserBase::matchesUnifiedHunkLine() returns False for such lines. I think the parsing of the hunk body must take into account the full information from the hunk header, because otherwise you cannot reliably tell where the hunk body ends. Created attachment 36277 [details]
Fix parsing of unified diffs
This patch for libdiff2 modifies the parsing of unified diffs to take into account the full information given in the diff header. Now kompare correctly displays the unified diff example I gave earlier.
Patch looks sane. Can someone confirm that this fixes the bug with this testcase? I dont have a working KDE atm. Please also add this testcase for this bug to the testcases in kompare so we can make sure this bug does not return. Thank you very much for reporting the bug and for the patch! *** This bug has been marked as a duplicate of bug 208688 *** |