Bug 339143 - corrupt file saved when not owner of the directory
Summary: corrupt file saved when not owner of the directory
Status: RESOLVED DUPLICATE of bug 323693
Alias: None
Product: kate
Classification: Unclassified
Component: general (show other bugs)
Version: 3.12.4
Platform: openSUSE RPMs Linux
: NOR normal (vote)
Target Milestone: ---
Assignee: KWrite Developers
Depends on:
Reported: 2014-09-17 12:02 UTC by peter.maloney
Modified: 2014-09-20 10:10 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Note You need to log in before you can comment on or make changes to this bug.
Description peter.maloney 2014-09-17 12:02:53 UTC
Tile corruption happens when you shorten a file you saved already in kate and save again. The old ending appears at the end of the file. I don't know what other types of damage can occur.

Reproducible: Always

Steps to Reproduce:
1. Make a directory owned by root. Make a file there owned by your user.
    root@here # mkdir ~you/ownedbyroot
    root@here # touch ~you/ownedbyroot/thefile
    root@here # chown you ~you/ownedbyroot/thefile
2. Open the file with Kate as you, writing the content "12345", and save it.
3. Change the content with Kate to "999", and save it.
4. cat ~you/ownedbyroot/thefile

Actual Results:  
Step 4 says "99945" but should say "999". In Kate, you still see "999" though. The actual file content is wrong, so the file is corrupt.
Comment 1 Martin Walch 2014-09-20 10:10:54 UTC
As Kate cannot create a new file in the same directory, it writes into the existing file, but does not truncate it first.

This has been fixed in 3.12.5. If switching to a newer version is infeasible you can try asking your distribution maintainers to apply the fix to their repositories of 3.12.4.

Of course, if you still see the bug with newer versions of Kate, feel free to reopen this bug.

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