[okular] [Bug 402017] Cannot save PDF when loaded file has been deleted
Sven Brauch
bugzilla_noreply at kde.org
Sun Jul 26 12:37:10 BST 2020
https://bugs.kde.org/show_bug.cgi?id=402017
--- Comment #47 from Sven Brauch <mail at svenbrauch.de> ---
Sorry for not checking back, I had a look; for PDF it actually works perfectly
by just removing the error message, 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, which is where
I stopped -- sorry, need to pick that up again.
@Albert: I think you misunderstood. An open file descriptor refers to a
specific file, which is basically ref-counted by all open file descriptors and
all file names in the file system hierarchy referring to it. POSIX guarantees
you that it won't swap this *pointer* behind your back, but not that you always
get the same *contents*. So for modifying files, it depdends on how
applications do that: if they do open("filename"), write(), close() you get the
new contents; 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, it just depends on what
applications do.
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the Okular-devel
mailing list