[okular] [Bug 402017] Cannot save PDF when loaded file has been deleted
David Hurka
bugzilla_noreply at kde.org
Sun Jul 26 22:54:34 BST 2020
https://bugs.kde.org/show_bug.cgi?id=402017
--- Comment #48 from David Hurka <david.hurka at mailbox.org> ---
Sven wrote:
> if they do open("filename.tmp"), write(), close(),
> rename("filename.tmp", "filename"), you get the old contents,
> because the new contents are in a *different* file (which now
> happens to have the same name).
>
> So the behaviour is clear, well-defined and reliable,
Well, it’s not necessarily reliable. On your ext4 home partition it should
work, but if you use FAT for some reason, or even the thumb drive fails, the
data is still lost.
> but for other file types (e.g. PNG) we would need to keep the FD
> open manually. There actually already is code for that, which needs
> a slight refactoring to work correctly though,
I think for generators which can’t save(), we should just go the KISS way and
always make a temporary copy. Most document types other than PDF need (very)
much less space on disk than we need space on RAM to render a single viewport.
(E. g. PNG doesn’t have 30 other pages, TXT is always very compact.)
Which code do you mean? FileKeeper didn’t turn out to work very well, but if
you understand how to fix it... :)
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the Okular-devel
mailing list