Hello again,

I have one more question to ask related to mime-support and mailcap files.

Packages can install mailcap entries in /usr/lib/mime/packages/, which are
collected by update-mime from the mime-support via Dpkg triggers, and used
to produce the file /etc/mailcap, together with the information collected
from the Desktop files in /usr/share/applications.

The format of mailcap files allows for continuation lines, when the last
character of a line is a backslash that escapes the newline character.

    http://tools.ietf.org/html/rfc1524 (last paragraph of page 2).

update-mime supports this passively, since is to simply copies the contents of
the files in /usr/lib/mime/packages/ as they are.  That is, they are not
parsed.

However, this leads to the following bug.  The file /etc/mailcap.order can be
used to reorder the contents of the mailcap file according to the local user's
priorities.  But this is done with line-by-line matching, and therefore, an
entry spanning two lines will be broken in two parts here and there in
/etc/mailcap.

Given that this bug has not been reported since the ~16 years that the
mailcap.order system is in place in Debian, I conclude that is at least very
rare.  Indeed, Debian packages do not seem to use continuation lines in
the mailcap entries that they install in /usr/lib/mime/packages/:

To inspect them, I listed packages of interest with the following command:

    apt-file search usr/lib/mime/packages | cut -f 1 -d ':' > 
packagesWithMailcapFiles

I then used this list of packages to extract their mailcap files on 
lintian.debian.org.

    for package in $(cat packagesWithMailcapFiles)
    do
      for deb in /srv/mirrors/debian/pool/main/*/*/${package}_*_amd*deb
      do
        dpkg-deb --fsys-tarfile $deb | tar xf - ./usr/lib/mime/packages/$package
      done
    done 

I am therefore tempted to acknowledge this current practice by officially not
supporting continuation lines in the files installed in
/usr/lib/mime/packages/, instead of implementing more complex parsing.

The way I would do it would be to test for the presence of a media type
at the beginning of each line, and emit a warning otherwise.  This would
answer to http://bugs.debian.org/384161.

Please let me know if you see reasons for not doing so (and in that case,
patches are more than welcome).

Cheers,

-- 
Charles Plessy
Tsurumi, Kanagawa, Japan


-- 
To UNSUBSCRIBE, email to debian-devel-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: https://lists.debian.org/20140505030300.ge25...@falafel.plessy.net

Reply via email to