mutt does not find mailcap entry

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

mutt does not find mailcap entry

Beatrice Torracca
Hello,

I have been trying to make mutt open pdf files from the
view-attachment dialog.

I am using a Debian buster (Linux beapc 4.19.0-8-amd64 #1 SMP Debian
4.19.98-1 (2020-01-26) x86_64 GNU/Linux) with Mutt 1.10.1
(2018-07-13).

I was trying to make it open evince to view pdf files. It does not
seem to recognize the mime type. I tried the same steps I followed
with my Debian testing laptop (there the problem was a bit different
since it opened pdf files but with calibre).

Anyway I edited /etc/mailcap.order adding the line (it is the only line):

org.gnome.Evince:application/pdf

I ran (as root) the command "update-mime" that gave no error
messages. Now in my /etc/mailcap file the first entry is

application/pdf; evince %s; test=test -n "$DISPLAY"

In my /etc/mime.types I have a line entry for pdf like this

application/pdf                                 pdf

If I run the command "mutt -nF /dev/null -Q mailcap_path" to see the
path it uses to find mailcap entries I get this output

mailcap_path="~/.mailcap:/usr/share/mutt/mailcap:/etc/mailcap:/etc/mailcap:/usr/etc/mailcap:/usr/local/etc/mailcap"

I don't have a .mailcap file in my home directory. There is no other
mailcap file among those listed aside from /etc/mailcap.

Still when I have a mail with a pdf attachment and I see at the bottom
of the message in the attachment part

[-- application/pdf is unsupported (use 'v' to view this part) --]

I press v. I see the application/pdf attachment.
Then if I hit Enter I get this message

 "No matching mailcap entry found.  Viewing as text."

If I press "m" I get this error message
"mailcap entry for type application/pdf not found".

I don't understand why since I do have an application/pdf entry.

Anyone has any clues and can help me?

I did search a lot without getting to an answer (actually I did manage
to solve the problem on laptop, but not this one in buster). I might
be missing something very obvious.

Thanks in advance,

beatrice

Reply | Threaded
Open this post in threaded view
|

Re: mutt does not find mailcap entry

tomas@tuxteam.de
On Sat, Apr 04, 2020 at 02:43:24PM +0200, Beatrice Torracca wrote:
> Hello,
>
> I have been trying to make mutt open pdf files from the
> view-attachment dialog.
>
> I am using a Debian buster (Linux beapc 4.19.0-8-amd64 #1 SMP Debian
> 4.19.98-1 (2020-01-26) x86_64 GNU/Linux) with Mutt 1.10.1
> (2018-07-13).

Following your detailed description I'd expect it to work.

The only idea I can offer at the moment (and that's what
I'd try) is to run vim under strace to watch it trying
to open the mailcap and perhaps to exec evince. Since
mutt takes posession of the screen, it seems best to direct
strace's output to a file and examine it later. Like so:

  strace -f -o my_trace_file -e trace=open,%process mutt

(the -f is for "follow", to follow along forks; the -e filters
the system calls traced (the traces tend to be a bit...
intimidating).

Just try to do as few steps as you have to (until mutt tries
and fails to call evince), to keep the trace manageable.

Hope that helps
-- tomás

signature.asc (205 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: mutt does not find mailcap entry

David Wright-3
In reply to this post by Beatrice Torracca
On Sat 04 Apr 2020 at 14:43:24 (+0200), Beatrice Torracca wrote:

>
> I have been trying to make mutt open pdf files from the
> view-attachment dialog.
>
> I was trying to make it open evince to view pdf files. It does not
> seem to recognize the mime type. I tried the same steps I followed
> with my Debian testing laptop (there the problem was a bit different
> since it opened pdf files but with calibre).
>
> Anyway I edited /etc/mailcap.order adding the line (it is the only line):
>
> org.gnome.Evince:application/pdf
>
> I ran (as root) the command "update-mime" that gave no error
> messages. Now in my /etc/mailcap file the first entry is
>
> application/pdf; evince %s; test=test -n "$DISPLAY"
>
> In my /etc/mime.types I have a line entry for pdf like this
>
> application/pdf                                 pdf
>
> If I run the command "mutt -nF /dev/null -Q mailcap_path" to see the
> path it uses to find mailcap entries I get this output
>
> mailcap_path="~/.mailcap:/usr/share/mutt/mailcap:/etc/mailcap:/etc/mailcap:/usr/etc/mailcap:/usr/local/etc/mailcap"
>
> I don't have a .mailcap file in my home directory. There is no other
> mailcap file among those listed aside from /etc/mailcap.
>
> Still when I have a mail with a pdf attachment and I see at the bottom
> of the message in the attachment part
>
> [-- application/pdf is unsupported (use 'v' to view this part) --]
>
> I press v. I see the application/pdf attachment.
> Then if I hit Enter I get this message
>
>  "No matching mailcap entry found.  Viewing as text."
>
> If I press "m" I get this error message
> "mailcap entry for type application/pdf not found".
>
> I don't understand why since I do have an application/pdf entry.
>
> Anyone has any clues and can help me?
FWIW this is how I approach viewing attachments.
In ~/.mutt/muttrc I have:

$ grep mailcap .mutt/muttrc
auto_view       text/html # immediate display (without v command), assumes mailcap support
set             mailcap_path=$HOME/.mutt/mailcap-mutt # needed for auto_view
$

and ~/.mutt/mailcap-mutt is attached.

However, I can't help you actually view the document with evince
because, although evince opens, it gives a "Permission denied" error.
Although mutt writes the attachment as a temporary file with
-r-------- permissions, and I can open that file with xpdf even as
evince is still displaying the error message, evince can't.
If I try to open it with evince from another xterm, I "warp to" the
single evince window already displaying it.

I also tested zathura from another xterm, as you can see from the
attachment here, and that worked fine.

So AFAICT evince (which I don't normally use) works differently.

Notes: I run X with startx, and fvwm, so no DE here.
       I use an individual mailcap for mutt so that I don't
       get big applications starting by surprise.
       As you can see, I've tested different ways of handling
       HTML at various times.

Cheers,
David.

mailcap-mutt (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: mutt does not find mailcap entry

Andrei POPESCU-2
In reply to this post by Beatrice Torracca
On Sb, 04 apr 20, 14:43:24, Beatrice Torracca wrote:
> Hello,
>
> I have been trying to make mutt open pdf files from the
> view-attachment dialog.
>
> I am using a Debian buster (Linux beapc 4.19.0-8-amd64 #1 SMP Debian
> 4.19.98-1 (2020-01-26) x86_64 GNU/Linux) with Mutt 1.10.1
> (2018-07-13).

Opening pdf files works for me without any special configuration with
neomutt and mupdf under LXDE.

Kind regards,
Andrei
--
http://wiki.debian.org/FAQsFromDebianUser

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: mutt does not find mailcap entry

Beatrice Torracca
In reply to this post by tomas@tuxteam.de
On Sat April 4th tomás wrote:

> Since
> mutt takes posession of the screen, it seems best to direct
> strace's output to a file and examine it later. Like so:
>
>   strace -f -o my_trace_file -e trace=open,%process mutt

Hi,

I tried that. Then I realized I have to apologize.

My first try with modifying the mailcap.order file, did work. To test
it I was just trying to use it from a text console (yeah, brain
obviously not turned on). This is why obviously evince could not start
without a graphical environment.

It was stupid of me. Thanks to tomás, Andrei and David for trying to
help me.

Actually I did learn about strace and I want to test some of
David solutions for seeing html mails (which is another thing bugging
me).

Thanks again, and a good Sunday,

beatrice

Reply | Threaded
Open this post in threaded view
|

Re: mutt does not find mailcap entry

tomas@tuxteam.de
On Sun, Apr 05, 2020 at 11:05:28AM +0200, Beatrice Torracca wrote:

> On Sat April 4th tomás wrote:
>
> > Since
> > mutt takes posession of the screen, it seems best to direct
> > strace's output to a file and examine it later. Like so:
> >
> >   strace -f -o my_trace_file -e trace=open,%process mutt
>
> Hi,
>
> I tried that. Then I realized I have to apologize.
No need for that :)

> Actually I did learn about strace and I want to test some of
> David solutions for seeing html mails (which is another thing bugging
> me).

After all, that's the point of the whole Great Exercise, isn't it?

Cheers
-- t

signature.asc (205 bytes) Download Attachment