kdiff3 1.9.2 on FreeBSD 13.0 + some minor kernel changes
Using kdiff3 for resolving git merge conflicts I noticed that output files sometimes have extra whitespace, and are missing a newline at EOF. I encountered this within the last month or two.
Reproduction steps - create test files:
printf 'line 1\nline 2-base\nline 3-base\nline 4\n' > base
printf 'line 1\nline 2-theirs\nline 4\n' > theirs
printf 'line 1\nline 2-mine\nline 4\n' > mine
kdiff3 -o out base theirs mine
Resolve the conflict choosing 'mine', save output
Observe that the output file has a blank 3rd line, and has no \x0a at EOF. By default I have LANG=en_CA.UTF-8 but observed also with LANG unset.
Could we perhaps revert to the old version, until this is fixed?
Created attachment 225807 [details]
revert to 1.8.5
Patch applied locally to revert to 1.8.5, which fixes the problem for me.
I set PORTEPOCH to 1 to handle the now-lower version number, but need a ports committer to check.
For those not conversant with kdiff3:
- invoke kdiff3 as Ed says, `kdiff3 -o out base theirs mine`
- it comes up with a "Conflicts" dialog, saying Total 2, auto-solved 1, 1 unsolved; click *ok*
- the lower half of the window shows the *output* part, with each line displayed
<No src line>
There's a kind of highlight on the first conflict line. Press ctrl-3 **or** right-mouse-click on that line and select *C* (with the files in the order given in the command, *base* is *A*, *theirs* is *B*, and *mine* is *C*). The conflict marker is replaced by the content of the line from file *C*.
Now the number at the bottom says "0 unresolved", and you can hit ctrl-S to save and ctrl-Q to quit.
Output of `od -c` on the result:
0000000 l i n e 1 \n l i n e 2 - m i
0000020 n e \n \n l i n e 4
I'm going to apply https://invent.kde.org/sdk/kdiff3/-/merge_requests/31 to packaging instead, since that fixes the problem in 1.9.2 and we don't need to mess with PORTEPOCH.
A commit in branch main references this bug:
Author: Adriaan de Groot <adridg@FreeBSD.org>
AuthorDate: 2021-06-14 23:00:52 +0000
Commit: Adriaan de Groot <adridg@FreeBSD.org>
CommitDate: 2021-06-14 23:03:16 +0000
textproc/kdiff3: fix output of merged file
Fix spurious newlines and missing newline at the end of file.
Upstream report: https://bugs.kde.org/show_bug.cgi?id=437570
Upstream merge request: https://invent.kde.org/sdk/kdiff3/-/merge_requests/31
Reported by: emaste
textproc/kdiff3/Makefile | 1 +
.../files/patch-src_mergeresultwindow.cpp (new) | 50 ++++++++++++++++++++++
2 files changed, 51 insertions(+)
I've checked that this fixes at least the example Ed gave and some other weirdness.
Most excellent, thank you!