Package: mime-support
Version: 3.62
Severity: important

Hello,

thank you for maintaining mime-support.

>From what I understand, entries in /etc/mailcap are sorted by package
name. As a consequence, people who install, for example, calibre, will
find that it opens quite a lot of file types (which it can do), with a
higher priority over the software one would expect: calibre comes
alphabetically before evince, okular, libreoffice, and most other
packages.

There is only a limited way to control this system-wide with
/etc/mailcap.order, and no way for users to control ordering.

As a user, I can grep /etc/mailcap and paste my preferred entries in
~/.mailcap, but at that point I have hardcoded those command lines in a
way outside the control of package maintainers.

Suppose that a package has an exploitable command line, and given
#928037 it might well be, and a new version fixes it in its mime
information, my ~/.mailcap will be stuck with the exploitable version
forever.

Suppose that a package changes command line options and updates its mime
information correctly, my ~/.mailcap will be stuck with a nonfunctioning
command line, and I'll spend an afternoon trying to figure out why mutt
suddenly can't open PDFs anymore, retracing and relearning the chain of
commands and configuration files that go on behind the scenes. I
personally found it really nontrivial to figure out.

I'm trying to resist the temptation to write and package a tool called
aaanything that uses aalib to display as many file types as possible,
and provides mime informations accordingly, so that it will sort before
pretty much any other package.

What I did as a workaround in my system[1], was to add entries in my
~/.mailcap that delegate to xdg-open, like:

  application/pdf; xdg-open %s && sleep 0.3s; test=test -n "$DISPLAY"

Is there a reason this kind of behaviour could not be a default?

I'm opening this issue to document this kind of surprising and possibly
dangerous behaviour coming out of the way mime-support works.

I can't think of many options besides delegating to xdg-open: there
doesn't seem a way for packages to declare a priority for their mime
support, and even if there was, it would be arbitrary.

I could think of packaging something that diverted run-mailcap to a
wrapper to xdg-open, falling back to the original run-mailcap if
xdg-open doesn't have a mapping, or if DISPLAY is not set.

I could think of packaging a program called 0xdg-mime that depends on
xdg-utils and registers xdg-open as mime handler for as many entries as
possible.

I really don't feel good about the current situation being the standard
user interface for mime handling in Debian.


Enrico

[1] https://www.enricozini.org/blog/2020/debian/mime-type-associations/


-- System Information:
Debian Release: 10.4
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 5.6.0-0.bpo.2-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_IE.UTF-8, LC_CTYPE=en_IE.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_IE:en (charmap=UTF-8)
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

mime-support depends on no packages.

Versions of packages mime-support recommends:
ii  bzip2     1.0.6-9.2~deb10u1
ii  file      1:5.35-4+deb10u1
ii  xz-utils  5.2.4-1

mime-support suggests no packages.

-- no debconf information

Reply via email to