Bug 499331 - KDiff3 displays error message when saving a completed merge.
Summary: KDiff3 displays error message when saving a completed merge.
Status: RESOLVED FIXED
Alias: None
Product: kdiff3
Classification: Applications
Component: application (show other bugs)
Version: 1.12.0
Platform: Microsoft Windows Microsoft Windows
: HI normal
Target Milestone: ---
Assignee: michael
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-01-30 15:24 UTC by Chad
Modified: 2025-03-09 01:24 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chad 2025-01-30 15:24:07 UTC
SUMMARY
I have set KDiff3 as my default merge tool for Git.  When a conflict occurs, the 

STEPS TO REPRODUCE
1. Start resolving a conflict using git's mergetool command with KDiff3 as the merge tool.
2. Resolve the conflicts and attempt to save the file.
3.  Attempt to save the merged file.

OBSERVED RESULT
You will receive an error message stating: "Error while writing".  This does not happen with every save, but most of the time.

EXPECTED RESULT
The file should save without an error.

SOFTWARE/OS VERSIONS
Windows: Windows 11 Enterprise 23H2
macOS: 
(available in the Info Center app, or by running `kinfo` in a terminal window)
Linux/KDE Plasma: 
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
This has only become an issue with the newest version of KDiff3.  Older versions worked just fine. I am using a virtual hard drive mounted to my system as the F: drive, which has not been a problem in the past.
Comment 1 michael 2025-02-07 00:24:43 UTC
The fix is at https://invent.kde.org/sdk/kdiff3/-/commit/09b2adaa9e4dc89d02d6cff1e387408d5c5e2dbe it arrived just ahead the switch to 1.12 branch for releases.
It should apply cleanly to 1.11.5.
Comment 2 michael 2025-02-07 00:24:51 UTC
*** This bug has been marked as a duplicate of bug 486782 ***
Comment 3 michael 2025-02-07 00:26:00 UTC
wrong bug and bugzila doesn't support deleting comment.
Comment 4 michael 2025-02-07 00:27:41 UTC
I think I see what caused this will attempt a fix shortly.
Comment 5 michael 2025-02-08 00:12:01 UTC
Git commit 27ffe00cbeb7f8d742e31591a94a62528007ec2c by Michael Reeves.
Committed on 07/02/2025 at 23:24.
Pushed by mreeves into branch '1.12'.

Errors produced during merge encoding should be ingnored

This restores the original behavoir.
FIXED: 1.12.1

M  +2    -3    src/mergeresultwindow.cpp

https://invent.kde.org/sdk/kdiff3/-/commit/27ffe00cbeb7f8d742e31591a94a62528007ec2c
Comment 6 michael 2025-02-08 00:18:43 UTC
Git commit 08b39c11545ee73b0c2bfd487b22c67a87200361 by Michael Reeves.
Committed on 07/02/2025 at 23:23.
Pushed by mreeves into branch 'master'.

Errors produced during merge encoding should be ingnored

This restores the original behavoir.
FIXED: 1.12.1

M  +2    -3    src/mergeresultwindow.cpp

https://invent.kde.org/sdk/kdiff3/-/commit/08b39c11545ee73b0c2bfd487b22c67a87200361
Comment 7 Chad 2025-03-06 18:04:36 UTC
Just updated to version 1.12.1 of KDiff3.  The save error message is no longer occurring, but a new, more severe issue is now happening.  When performing a 3-way merge to resolve a conflict,  the merged content appears to save, but instead of saving, all content in the file is removed. This has happened twice, forcing me to revert to an older version.
Comment 8 michael 2025-03-06 18:20:33 UTC
Please open a new bug for the save failing. This bug can referenced there as the that change made her may be related.
Comment 9 michael 2025-03-06 18:29:25 UTC
Encoding of the data stream is failing in the question is why? For stable it is not possible to add a separate error string for this due to string freeze. Master has this implemented. Erroring seems the better of the two options. Previously this situation would have been ignored. Qt dropped there custom codecs when going to Qt6.
Comment 10 michael 2025-03-06 18:39:34 UTC
What are your encoding settings?
Comment 11 michael 2025-03-06 18:54:17 UTC
Going push a stop gap fix to 1.12 to prevent merges from being saved if the encoding error flag is triggered. Not the complete answer but will prevent data loss until I can sort out what is happening in full. Master  has a separate warning dialog for encoding errors which still should not be causing a blank file.
Comment 12 michael 2025-03-06 18:57:45 UTC
This patch to  1.12 will produce a error message in the event of encoding failure. A console message will generated if encoding fails to produce an data. With 1.12 GUI messages can't be added so I will look what else I can do.
Comment 13 michael 2025-03-09 01:24:31 UTC
1.12 should now work as expected. The next release will introduce a unique message for when an encoding error happens. This message will implement a "Don't show again" feature for those who don't want it. Be prepared to check the resulting file when this warning is show as indicates possible substitution of invalid code points. This is done a the discretion of the underlining text codec.