Bug 376937

Summary: kwrite creates new file as opposed to updting exiting file
Product: [Applications] kate Reporter: Andrew S <noway.hose699>
Component: kwriteAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED DUPLICATE    
Severity: wishlist    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:

Description Andrew S 2017-02-26 01:36:30 UTC
Just upgraded from CentOS6 to CentOS 7 and hence from kwrite 4.3.4
to kwrite 4.14.8.
This version of kwrite always creates a new file as opposed to updating the 
exiting file, i.e. the file i-node changes. For the most part this does
not matter, but does have subtle implications:
a) this means I cannot edit a file to which I have write access, but is located in a directory where I don't have write access; and
b) this breaks any exiting hard-links to the file.
Comment 1 Dominik Haumann 2017-02-26 16:58:44 UTC
The reason for this is that we use QSaveFile [1] to safely save data to disk: It saves to a temporary file, and on success, the temporary file is moved to the final location. This leads to this bug, bug avoids data loss in case of a crash (e.g. power outage). Let's track this in bug #358457.

We track these problems here:
- https://bugs.kde.org/show_bug.cgi?id=354405 Files are unlinked on save
- https://bugs.kde.org/show_bug.cgi?id=358457 Kate removes hard links
- https://bugs.kde.org/show_bug.cgi?id=333577 Kate changes file owner

[1] http://doc.qt.io/qt-5/qsavefile.html

*** This bug has been marked as a duplicate of bug 358457 ***