[okular] [Bug 402017] Cannot save PDF when loaded file has been deleted

David Hurka bugzilla_noreply at kde.org
Wed May 13 23:56:44 BST 2020


https://bugs.kde.org/show_bug.cgi?id=402017

David Hurka <david.hurka at mailbox.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pino at kde.org

--- Comment #13 from David Hurka <david.hurka at mailbox.org> ---
Please look at the following. It seems like keeping the file was implemented in
2008, specifically with Firefox in mind. But it broke something else, so it was
disabled using an #undef. There is no way anymore to enable it with a compile
switch or through an environment variable. It was also only implemented for
UNIX OSes.

@Pino: Can you tell more about the problem? Can it be fixed, or do we need
another approach than creating a file handle?

If we need another approach, I vote for creating a temporary full copy of the
file, if
a) the file is smaller than a limit, set by the memory performance mode
b) (optionally) the file is from a remote location or has a path that is likely
to be temporary (e. g. /tmp/, or **/.*/)

---- APPENDIX A: This is a self-descriptive heading for an appendix ----

commit 5b5b4cabe1d8e07392641ba9cf574eda4678b12f
Author: Pino Toscano <pino at kde.org>
Date:   Sat Jun 7 21:52:11 2008 +0000

    disable the open handle on the file, it breaks the file watching

    CCBUG: 163363

    svn path=/trunk/KDE/kdegraphics/okular/; revision=818144

diff --git a/part.cpp b/part.cpp
--- a/part.cpp
+++ b/part.cpp
@@ -182,8 +182,5 @@
 #undef OKULAR_KEEP_FILE_OPEN
-#if defined(Q_OS_UNIX)
-#  define OKULAR_KEEP_FILE_OPEN
-#endif

 #ifdef OKULAR_KEEP_FILE_OPEN
 static bool keepFileOpen()
 {

commit 6531398b919e58def8c6ba4711d20ea517147189
Author: Pino Toscano <pino at kde.org>
Date:   Sat Jun 7 21:08:41 2008 +0000

    Keep an open file handle on the local file currently open: this way, we can
get it back from it,
    in case for some reason (read: Firefox blindly removing temporary files) it
gets "deleted".
    Of course, this works (and thus it is activated) only on UNIX systems (as
the file is not deleted for real until there are open handles on it).
    BUG: 163363
    (If not wanted, this behavior can be disabled by export'ing
OKULAR_NO_KEEP_FILE_OPEN to 1.)

    Also, in case the local file gets deleted but the real document is remote,
use its (remote) URL for the copy.

    svn path=/trunk/KDE/kdegraphics/okular/; revision=818136

diff --git a/part.cpp b/part.cpp
--- a/part.cpp
+++ b/part.cpp
@@ -124,0 +182,8 @@
+#undef OKULAR_KEEP_FILE_OPEN
+#if defined(Q_OS_UNIX)
+#  define OKULAR_KEEP_FILE_OPEN
+#endif
+
+#ifdef OKULAR_KEEP_FILE_OPEN
+static bool keepFileOpen()
+{

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the Okular-devel mailing list