Hi k-c-d / kwrite-devel, Kate uses KSaveFile in KDE 4.10 to avoid data loss during save operations. According to [1] KSaveFile will be deprecated in favor of QSaveFile with kf5/Qt5.1.
Unfortunately, using KSaveFile introduces quite some regressions in Kate: 1. KSaveFile: Kate/kwrite makes a copy of a file while editing a hard link https://bugs.kde.org/show_bug.cgi?id=316240 2. KSaveFile: Unable to save file (777 permission) when the directory have 444 https://bugs.kde.org/show_bug.cgi?id=312415 3. Kate changes owner of editing file (edit) https://bugs.kde.org/show_bug.cgi?id=316234 (likely KSaveFile issue) Looking at the API/the code [1], QSaveFile seems to have the same behavior as KSaveFile. It looks like 1 (hard links) and 3 (file permissions/owner) are definitely bugs in KSaveFile. Maybe QSaveFile is also affected (David?)? The code in line 214 in [2] does look ok. Does it also set file owner? 2 (directory permissions) are hard to fix in KSaveFile. The only way out would be to allow saving to the file directly in case of file permissions are ok, but directory permissions are not. What's the best way to fix that? I already see us writing yet another KateFile class that tries to use K/QSaveFile, and in case of failure falls back to QFile directly... doesn't sound too appealing to me :-) Greetings, Dominik [1] https://codereview.qt-project.org/#change,41790 [2] https://codereview.qt-project.org/#patch,sidebyside,41790,10,src/corelib/io/qsavefile.cpp
