[krita/video-export-rebased] libs/ui: Save to a temporary file, then copy the result over on success (fwd)
Fazekas László
mneko at freemail.hu
Tue Aug 16 16:09:56 UTC 2016
Maybe this way?
1. copy the original file into original.bak in the same folder
- if the disk space is not enough, then drop the .bak file
2. write the new contents into the original file
-in case of a full disk error, delete the .bak file and try to continue
-if any other error happens, you can stop with an error (it's safer to
leave the files)
3. if everything finished well, delete the .bak file (or optionally keep it)
This way you never delete or rename the original file.
For network files, I think it's not safe if you create the file locally
in tmp, then save it over the original. This can damage the original,
since networking is also not safe.
Fazek
2016-08-16 17:32 keltezéssel, Dmitry Kazakov írta:
> Can we somehow limit this behavior to network files only?
>
>
> There are two problems I see:
>
> 1) If some other application, like Blender, is waiting on Krita-edited file
> with inotify (QFileSystemWatcher), it may go crazy when we rename and
> delete the file. The inotify opject will be destroyed after that.
> 2) What if the user works with 700MiB image? It mean he needs twice the
> size of the image free space just to be able to save it. Many people will
> be unhappy with it.
> 3) What if there is not enough free space in Temp folder? The user will
> never be able to save the image? That is a dataloss bug.
>
>
> ---
> Dmitry Kazakov
>
More information about the kimageshop
mailing list