Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

text alpine: PDF viewer: This file can not be found.

428 views
Skip to first unread message

Howie

unread,
Nov 9, 2011, 8:27:26 AM11/9/11
to
Hi all,

I am using text based alpine in Enterprise Linux 6.

I used to be able to "view" PDF files which were included as
attachments to emails I received. But recently, I am having a
difficulty, and this isn't working any longer.

I will describe what happens:

When I get to the email. I hit "v" and then when I get to the
attachment I hit "v" again.

Then I am queried:

View selected Attachment?
Y [Yes]
N No

I hit "y" then it states,

viewer command launched.

However, when I look at the viewer (Adobe reader) it has an error
statement:

"There was an error opening this document. this file cannot be
found."

Like I said this used to work, but no longer. Does anybody know how
to debug this?

Best regards, Howie

Holger Marzen

unread,
Nov 9, 2011, 9:25:41 AM11/9/11
to
* On Wed, 9 Nov 2011 05:27:26 -0800 (PST), Howie wrote:

> I used to be able to "view" PDF files which were included as
> attachments to emails I received. But recently, I am having a
> difficulty, and this isn't working any longer.
>
> I will describe what happens:
>
> When I get to the email. I hit "v" and then when I get to the
> attachment I hit "v" again.
>
> Then I am queried:
>
> View selected Attachment?
> Y [Yes]
> N No
>
> I hit "y" then it states,
>
> viewer command launched.
>
> However, when I look at the viewer (Adobe reader) it has an error
> statement:
>
> "There was an error opening this document. this file cannot be
> found."
>
> Like I said this used to work, but no longer. Does anybody know how
> to debug this?

1) The reader forks. The foreground process returns, the background
process starts the reader. Alpine thinks you have finished viewing the
attachment and deletes the temporary file. The background process wants
to open an file that no longer exists.

2) The reader doesn't get the filename of the temporary file.

Can you post /etc/mailcap?

Howie

unread,
Nov 9, 2011, 9:42:43 AM11/9/11
to
----------------------------------------------------------------
###
### Begin Red Hat Mailcap
###

audio/*; /usr/bin/xdg-open %s

image/*; /usr/bin/xdg-open %s

application/msword; /usr/bin/xdg-open %s
application/pdf; /usr/bin/xdg-open %s
application/postscript ; /usr/bin/xdg-open %s

text/html; /usr/bin/xdg-open %s ; copiousoutput

----------------------------------------------------------------

I have tried to execute /usr/bin/xdg-open on a pdf file and it opens
it using
adobe reader correctly. So I am not sure what is going on, or why it
thinks the
file can not be found.

Marc

unread,
Nov 9, 2011, 10:05:41 AM11/9/11
to
What alpine does is roughly:
/usr/bin/xdg-open file.pdf; rm file.pdf
which is not quite what you tried.

Holger Marzen

unread,
Nov 9, 2011, 10:22:21 AM11/9/11
to
* On Wed, 9 Nov 2011 06:42:43 -0800 (PST), Howie wrote:

> On Nov 9, 9:25 am, Holger Marzen <hol...@marzen.de> wrote:
>> * On Wed, 9 Nov 2011 05:27:26 -0800 (PST), Howie wrote:
>> > I used to be able to "view" PDF files which were included as
>> > attachments to emails I received.  But recently, I am having a
>> > difficulty, and this isn't working any longer.

>> 1) The reader forks. The foreground process returns, the background
>> process starts the reader. Alpine thinks you have finished viewing the
>> attachment and deletes the temporary file. The background process wants
>> to open an file that no longer exists.
>>
> application/pdf; /usr/bin/xdg-open %s

> I have tried to execute /usr/bin/xdg-open on a pdf file and it opens
> it using adobe reader correctly. So I am not sure what is going on, or
> why it thinks the file can not be found.

xdg-open returns to the command line and runs the pdf-viewer in the
background. This can lead to the race condition I described.

Other mail programs like mutt have the same problem, see
https://bugzilla.redhat.com/show_bug.cgi?id=653249

One solution could be that you alter /etc/mailcap or create a personal
$HOME/.mailcap with something like

application/pdf; acroread '%s'; test=test -n "$DISPLAY"; nametemplate=%s.pdf

LC's No-Spam Newsreading account

unread,
Nov 9, 2011, 12:35:56 PM11/9/11
to
On Wed, 9 Nov 2011, Holger Marzen wrote:

> One solution could be that you alter /etc/mailcap or create a personal
> $HOME/.mailcap with something like

Two collateral pieces of information.

One can set Mailcap Search Path to a list of files. Min is as follows:

Mailcap Search Path = ~/.mailcap:~/.mailcap.pine

so I can use a generic one and one specific for alpine. The latter has
Application/PDF; /usr/bin/X11/acroread %s

The other file is the one pointed by Mimetype Search Path. Mine (the
file) contains among others

application/pdf pdf PDF

the side advantage of this is that, when somebody sends a pdf file with
a content-type of octet-stream or other unspecified, alpine asks me
whether I want to open it by file extension.

the mime type file maps file extensions to mime types
the mailcap file maps mime types to viewers

Howie

unread,
Nov 9, 2011, 1:35:12 PM11/9/11
to
On Nov 9, 12:35 pm, LC's No-Spam Newsreading account
Thanks all. I added a new .mailcap file and now it looks as though my
pdf files are opening again.
0 new messages