Bug 163363 - cannot save open documents to new location
Summary: cannot save open documents to new location
Status: RESOLVED NOT A BUG
Alias: None
Product: okular
Classification: Applications
Component: general (show other bugs)
Version: 0.6.3
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
: 271358 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-06-06 14:46 UTC by Bohan
Modified: 2011-04-20 16:30 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bohan 2008-06-06 14:46:46 UTC
Version:           0.6.3 (using 4.0.4 (KDE 4.0.4), 4.0.4-4.fc9 Fedora)
Compiler:          gcc
OS:                Linux (x86_64) release 2.6.25.3-18.fc9.x86_64

When clicking on a PDF link in konqueror from a web site, the document is automatically downloaded to tmp and opened with okular. Later, when you try to save a copy to your home directory, okular responds with the message "cannot save to file:///home/..."
Comment 1 Pino Toscano 2008-06-06 14:58:31 UTC
Works here.
What is the complete error message?
Comment 2 Bohan 2008-06-06 15:10:13 UTC
title: information - okular

File could not be saved in 'file:///home/bh/Documents/dwthj4rrfhrf'.
Try to save it to another location.

buttons: OK

actually this does not always happen. It happened to me three time
yesterday but cannot produce it just now. I will give you a specific
case when I find it again.

Thanks for the prompt response
Comment 3 Dem 2008-06-07 12:05:01 UTC
Same problem with kpdf after following a link to a .pdf file in Firefox. I can view the file on the screen, can print it, but cannot save it. The same error message comes up. Strangely enough there is no .pdf file with same name in /tmp.
Comment 4 Pino Toscano 2008-06-07 13:04:03 UTC
I can reproduce the problem by opening an url with okular from firefox (iceweasel, for what matters), and then closing the firefox window.
It seems firefox removes the temporary downloaded file when closing, thus okular bails out that way.
I can add a workaround to make okular downloads the file, in case it is a remote file and the local temporary file is gone. Although, this IMHO is also a firefox bug.
Comment 5 Bohan 2008-06-07 14:42:11 UTC
it would be good enough I suppose it okular just tells the user that the file that was opened has been deleted. We cannot expect okular to some how prevent the deletion can we? If okular locks the file for writing then problems will occur when we use it as a preview screen while editing e.g TeX documents (where one recompiles repeated to see changes and just has to refresh in okular instead of having to open it over and over).

Another way to solve it might be to keep opened files in swap or a cache, though this does not scale to very large documents (100MB+) as loading times would be terrible.
Comment 6 Pino Toscano 2008-06-07 23:09:11 UTC
SVN commit 818136 by pino:

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.


 M  +113 -2    part.cpp  
 M  +2 -0      part.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=818136
Comment 7 Pino Toscano 2008-06-07 23:10:56 UTC
For sake of completeness, bug reports against Firefox and its "nice" behaviour:
  https://bugzilla.mozilla.org/show_bug.cgi?id=437767
Comment 8 Pino Toscano 2008-06-07 23:52:40 UTC
SVN commit 818144 by pino:

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

CCBUG: 163363


 M  +0 -3      part.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=818144
Comment 9 Pino Toscano 2008-06-07 23:56:26 UTC
Sadly, I have to reopen the bug, as the solution (well, the hack) conflicts with the file watching.

The only solution that Okular can offer in these cases (local file only, that gets deleted) is an error message, sorry.
I will add it as soon as I get the permission from the KDE translators.

For the general problem, please refer to the Firefox bug linked in comment #7.
Thanks for understanding.
Comment 10 Pino Toscano 2008-07-22 22:04:50 UTC
The information dialog for informing the user about such situation has been added. As explained in comment #4 and #9, Okular cannot do more about this problem, that has been reported (see comment #7).

Thus, closing.
Comment 11 Pino Toscano 2011-04-20 16:30:44 UTC
*** Bug 271358 has been marked as a duplicate of this bug. ***