Bug 390170 - QSaveFile: kate reset rating of saved files
Summary: QSaveFile: kate reset rating of saved files
Status: RESOLVED FIXED
Alias: None
Product: frameworks-ktexteditor
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: unspecified
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords: reproducible
Depends on:
Blocks:
 
Reported: 2018-02-09 19:32 UTC by Duns
Modified: 2018-08-19 13:09 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.50.0


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Duns 2018-02-09 19:32:07 UTC
F.e. saving an html with 3 baloo.rating (ext attr), I get an html with 0 baloo.rating.
Not so with LibreOffice and odt, ods files, or Sigil with epub, or Showphoto with jpg.
It's a bug, I believe: why kate change the file rating?
Thank you
Comment 1 Duns 2018-02-23 15:32:23 UTC
Nobody can answer?
Comment 2 Kåre Särs 2018-02-23 20:16:24 UTC
This is a side effect of using QSaveFile which first writes the new data to a temporary file and then renames the new file over the old one. This renaming is atomic which means that we always have either the old data or the new. We never get into the situation that only parts of the file is written. This unfortunately also means that thee are some corner cases that are not handled correctly. In your situation I think that the meta-data is not copied to the new file. QSaveFile does handle file attributes for the most common situations.
Comment 3 Duns 2018-02-24 06:22:10 UTC
Thank you,  Kåre Särs. So there is now no possible solution... Maybe a next release of Kate (but the problem there is also with html modified with others text editor, such gedit)?
Comment 4 Christoph Cullmann 2018-08-18 09:17:56 UTC
Remove QSaveFile in favor of plain old file saving

Summary: Rationale: for many use cases that e.g. have acls, complex other extended attributes, static links e.g. the rename() doesnt do the trick it should other ways would be start to add workarounds to all cases, which is hard, e.g. if that is something shared via SMB...

Test Plan: make && make test

Reviewers: dhaumann, dfaure

Reviewed By: dhaumann, dfaure

Subscribers: dfaure, kwrite-devel, kde-frameworks-devel

Tags: #kate, #frameworks

Differential Revision: https://phabricator.kde.org/D14890
Comment 5 Duns 2018-08-19 08:29:46 UTC
I honestly did not understand how the problem is solved. It still gives me the same behavior...
Comment 6 Christoph Cullmann 2018-08-19 08:49:50 UTC
Kate master no longer unlinks the file but only directly writes to it. That avoids the loss of the meta data.
Comment 7 Duns 2018-08-19 10:50:43 UTC
I tried with Kate 16.08.0-KF5.27 appimage (in Kubuntu there is still an old realease), but it dit not work (with a html and a php file)
 :(
Comment 8 Christoph Cullmann 2018-08-19 11:43:53 UTC
Hi, you can not try that with that app image.
You need a very recent version for that compiled from the master branch.
Frameworks 5.50 will contain the fix. Everything below will be broken.
Comment 9 Duns 2018-08-19 13:09:38 UTC
Ok, thank you very much!!