Package: alpine
Version: 2.20+dfsg1-7
Severity: normal

Dear Maintainer,

Quick version:

alpine seems to quit reading /etc/mailcap when it hits an invalid entry.
This may keep alpine from launching an application to read an attachment,
if the MIME type for the attachment appears after the invalid entry in
/etc/mailcap.

I think alpine should be more lenient when parsing /etc/mailcap .  Or, it
should warn the user somehow that it stopped parsing /etc/mailcap due to
an invalid entry, to give the user a chance to fix the problem.

Long version:

What happened:

Someone sent me an email with a Microsoft Word document attached, with
MIME type application/msword .  I opened the email in alpine, selected
(V)iew, went down to the attachment, hit Enter, and alpine told me it
didn't know how to open application/msword files.  This wasn't what I
expected; I expected alpine to launch a program to show the attachment.

I have LibreOffice installed and working, and there were entries to
launch LibreOffice for application/msword files in /etc/mailcap , so I
wasn't quite sure why alpine said it didn't know what to do.

I used alpine's debug output (-d 5), which shows how alpine parses
/etc/mailcap line by line, and noticed that alpine didn't make it all
the way to the end of the file.  Eventually, I figured out that a bug
in another package had caused a poorly-formatted line to be written to
/etc/mailcap , as follows:

---
application/vnd.comicbook+zip; evince %s; test=test -n "$DISPLAY"
application/x-ext-cb7; evince %s; test=test -n "$DISPLAY"
; evince %s; test=test -n "$DISPLAY"
application/oxps; evince %s; test=test -n "$DISPLAY"
application/vnd.ms-xpsdocument; evince %s; test=test -n "$DISPLAY"
---

alpine stopped reading /etc/mailcap when it got to the line starting
with '; evince'.  The application/msword entry that launches
LibreOffice for a Word document appeared further down in the file, so
alpine never got to it.  The poorly-formatted entry was on line 326,
out of 769 lines total, so alpine was not seeing over half of the
entries in the file.

(The bug was #885864 against evince, which has since been fixed.
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=885864 )

What I did to fix it:

I edited that poorly-formatted line out of /etc/mailcap and tried again.
alpine was able to parse /etc/mailcap until it found the relevant
application/msword line and launch LibreOffice, so I could view the
attachment.

What I think should be different:

I think alpine should have kept on reading after it hit the invalid
entry in /etc/mailcap.  If it's looking for the ';' as a field
separator, it shouldn't stop parsing if the first field ends up null.
It might be appropriate to warn the user, or possibly print an entry
in the alpine debug log, if alpine has to skip a poorly-formatted
entry.

If the thinking is that it's still better to just stop parsing mailcap
when alpine sees a poorly-formatted line, then I think alpine should
warn the user somehow.  This would help make the distinction between
"I looked through all of your mailcap and couldn't find anything that
matched" and "I didn't look at all of your mailcap because your mailcap
file has a problem" clearer to the user.

The built-in debug option (-d switch) to alpine was helpful in finding
this problem, so... keep that functionality around!  :)

Thanks!

Matt Roberds

-- System Information:
Debian Release: 9.3
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.9.0-4-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)

Versions of packages alpine depends on:
ii  libc6             2.24-11+deb9u1
ii  libgssapi-krb5-2  1.15-1+deb9u1
ii  libkrb5-3         1.15-1+deb9u1
ii  libldap-2.4-2     2.4.44+dfsg-5+deb9u1
ii  libpam0g          1.1.8-3.6
ii  libssl1.0.2       1.0.2l-2+deb9u2
ii  libtinfo5         6.0+20161126-1+deb9u1
ii  mlock             8:2007f~dfsg-5

Versions of packages alpine recommends:
ii  alpine-doc  2.20+dfsg1-7

Versions of packages alpine suggests:
ii  aspell                                     0.60.7~20110707-3+b2
ii  exim4-daemon-light [mail-transport-agent]  4.89-2+deb9u2

-- no debconf information

Reply via email to