This forum has been archived. All content is frozen. Please use KDE Discuss instead.
Please use bugs.kde.org for bug reports or feature requests. Development related questions should be directed to the okular-devel mailing list.

mc (or rather run-mailcap) and remembering last page

Tags: None
(comma "," separated)
User avatar
danadam
Registered Member
Posts
3
Karma
0
I haven't found this problem mentioned anywhere else, so here it goes.

I had this problem that when I was opening PDF files from "mc" (Midnight Commander), it sometimes happened that Okular wasn't remembering the last page the file was opened and was always starting with the first page. Same with zoom level, always using the default setting.

It turns out that my Midnight Commander was configured to open PDF files using "see" command:
Code: Select all
# PDF
type/^PDF
    Open=(see %f >/dev/null 2>&1 &)
The "see" command is just a symbolic link to "run-mailcap" and mailcap is configured to use "okular". The thing with "run-mailcap" is that if the path of the file contains characters other than:
Code: Select all
[^[:alnum:],.:/@%^+=_-]
so in particular a space or a quotation, then "run-mailcap" makes a temporary copy of the file and opens that instead. From the man page:
SECURITY
A temporary copy of the file is opened if the file name matches the Perl
regular expression "[^[:alnum:],.:/@%^+=_-]", in order to protect from
the injection of shell commands, and to make sure that the name can
always be displayed in the current locale. In addition, the file is
opened using its absolute path to prevent the injection of command-line
arguments, for instance using file names starting with dashes.

So when I was opening PDF files from directories with spaces in "mc", I was actually opening a file with some temporary and random name. This was preventing Okular from remembering the last opened page and other document-specific settings, because Okular stores those settings based on the file name (and the file size).

Since then I changed my "mc" configuration to use "okular" directly.


Bookmarks



Who is online

Registered users: Bing [Bot], claydoh, Evergrowing, Google [Bot], rblackwell