Summary: | KSaveFile: Kate/kwrite makes a copy of a file while editing a hard link | ||
---|---|---|---|
Product: | [Unmaintained] kdelibs | Reporter: | Aleh <aleh> |
Component: | kdecore | Assignee: | kdelibs bugs <kdelibs-bugs> |
Status: | RESOLVED INTENTIONAL | ||
Severity: | normal | CC: | christoph, faure, nplatis, samjnaa, tcberner, throw-kdebugs |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | openSUSE | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Aleh
2013-03-06 18:59:20 UTC
I can confirm this bug on FreeBSD 10.0-CURRENT and Qt: 4.8.4 KDE Development Platform: 4.10.1 Kate: 3.10.1 Again, most certainly a KSaveFile issue: KSaveFile writes to a temporary file and then renames the file, probably turning the hardlink into a normal file. Generic KSaveFile issue. Thiago wrote this in https://codereview.qt-project.org/52059 : "Who says the effects are undesireable? The hardlink may have been placed there so a backup copy could exist if the file got modified. Think of how Git shares object files between repositories: a hardlink is created and, if the file is modified for any reason (not one of the WORM files), it breaks the hardlink -- COW behaviour." Dominik, Christoph: OK to close as WONTFIX (or INVALID)? I would be ok with that, hard links to user editable files are anyway a real corner case. The problem with this is that the link is SILENTLY reomved. A user will have gone to some trouble to create the hard link in the first place and its arrogant to assume that it needs to be broken by any editing. There needs to be an option within KSaveFile giving choice of saving method: 1. A mv into place, which can be atomic (good) and can be the default. 2. A cp into place, which is not atomic, but preserves any hard link. Further Observations: Most people would think it bizarre if editing a symlink generated a second copy of the file. Editing a file with nano (for example) preserves hard links, see the quotation above. *** This bug has been confirmed by popular vote. *** I completely agree with comment #6. I have recently had the need to use hard links for a specific purpose, only to find out that Kate and all the programs that use it destroy my links (without a choice or warning), which is totally unacceptable. |