martinkostolny added a comment.
Sorry for answering after a longer time. I need to be sure I understand everything correctly: ad checksum: I think it would be good to revert to previous code and start from ther (to ensure writing only once and not over d-bus): 1. create a temp file in the same directory as target file (privileged action1) 2. write contents 3. make a checksum and remember 4. change owner/group of the temp file (privileged action2) 5. rename temp file to target one (privileged action2) 6. check remembered checksum (privileged action2) 7. if check failed, notify user Just to be sure: the changing permissions race can only be avoided when I change it before committing the QSaveFile so the temp file is not changed after atomic rename, right? REPOSITORY R39 KTextEditor REVISION DETAIL https://phabricator.kde.org/D5394 To: martinkostolny, #ktexteditor, fvogt Cc: elvisangelaccio, aacid, ivan, lbeltrame, fvogt, apol, anthonyfieroni, cullmann, ltoscano, dhaumann, graesslin, davidedmundson, palant, kwrite-devel, dfaure, #frameworks, head7, kfunk, sars