Bug 387200 - Unable to save (override) without directory permissions
Summary: Unable to save (override) without directory permissions
Status: RESOLVED INTENTIONAL
Alias: None
Product: kolourpaint
Classification: Applications
Component: general (other bugs)
Version First Reported In: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: kolourpaint-support
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-11-22 03:43 UTC by Emmanuel Lepage Vallée
Modified: 2017-12-03 11:20 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Emmanuel Lepage Vallée 2017-11-22 03:43:37 UTC
Kolourpaint cannot save when it cannot create a temporary file. If the file is writable but the directory is not, it should fallback to overwriting the file directly instead of failing to save the file. It's a bigger issue when using Kio such as fish or ftp where the target directory is owner by a remote user.

To reproduce:
mkdir foo
sudo chown root:root foo
sudo wget http://nicecatpicture foo/cat.png
sudo chmod 666 foo/*
kolourpaint foo/*.png

<ctrl+s>

Result:
Fail to save file with an error

Expect:
Save file, with or without a warning
Comment 1 Martin Koller 2017-12-03 11:20:52 UTC
The way it's implemented right now is done to ensure an always intact image file: "write all or nothing".
It's using Qt's QSaveFile:
##########
QSaveFile is an I/O device for writing text and binary files, without losing existing data if the writing operation fails.

While writing, the contents will be written to a temporary file, and if no error happened, commit() will move it to the final file. This ensures that no data at the final file is lost in case an error happens while writing, and no partially-written file is ever present at the final location. Always use QSaveFile when saving entire documents to disk.
##########