...
 
Commits (101)
mime-support (3.55~experimental1) experimental; urgency=low
0f12ec4 Added ‘application/font-woff’
92def2a Remove the deprecated ‘application/x-font-woff’ type.
Closes: #727156
46df3ed Added vst vsw vss extensions to ‘application/vnd.visio’.
1a69660 Stop associating ‘dat’ files with
‘application/x-ns-proxy-autoconfig’. Closes: #418564.
020388a Add ‘application/gzip’ and ‘application/zlib’ media types.
Closes: #589991, 688872.
77eee72 Added ‘application/oebps-package+xml’ for ‘opf’ suffixes.
See also http://bugs.debian.org/712054.
c1797d2 Removed ‘application/x-md5’, there is no evidence for use.
Closes: #720619
a71f2b0 Update ‘text/x-vcard‘ to ‘text/vcard’ and associate with the
‘vcard’ suffix. Closes: #674670
-- Charles Plessy <plessy@debian.org> Sat, 23 Nov 2013 16:19:12 +0900
mime-support (3.62) unstable; urgency=medium
* Added media types
2f7cd89 application/wasm Closes: #908832
* Packaging
[ Ondřej Nový ]
d48da1b d/control: Fix wrong Vcs-*
[ Charles Plessy ]
426f2c8 Continuous integration on Salsa
638d524 Conforms to Policy version 4.3.0.
-- Charles Plessy <plessy@debian.org> Sat, 09 Feb 2019 21:32:33 +0900
mime-support (3.61) unstable; urgency=medium
* Added media types
2977585 fonts/* Closes: #900288, LP: #1380129
ad05776 application/epub+zip Closes: #712054
* Packaging
1909440 Remove Laszlo from the uploaders.
34beb90 New canonical URLs and standards-version.
5f46ab2 debian/postinst: remove removal of 'see'.
10a132d Use tracker.debian.org for the Maintainer field.
* Fixed many issued found by Lintian.
bb05b29 Lintian: file-contains-trailing-whitespace
1a2e972 Lintian: unnecessary-source-date-epoch-assignment
7e17789 Lintian: spelling-error-in-manpage
bfa7589 Lintian: insecure-copyright-format-uri
aab7e48 Lintian: command-with-path-in-maintainer-script
d858f9b Lintian: maintainer-script-ignores-errors
22b3f61 Lintian: maintainer-script-without-set-e
-- Charles Plessy <plessy@debian.org> Sat, 16 Jun 2018 17:55:26 +0900
mime-support (3.60) unstable; urgency=medium
5f9811a Add decoding and encoding support for xz.
Thanks to Nicolas Schier <nicolas@hjem.rpa.no> (Closes: #804211)
67c43e3 Removed bzip support.
13cbcc7 Recommend bzip2 and xz-utils, since run-mailcap uses them.
d2b5636 Escape a left curly bracket with a backslash.
(Warning since Perl 5.22, Closes: #810587)
fe8d90a Added text/markdown. (Closes: #802753)
bcf08d8 Conforms to Policy version 3.9.8.
3b341bf Use secure URIs in the VCS fields.
-- Charles Plessy <plessy@debian.org> Sun, 01 May 2016 20:20:22 +0900
mime-support (3.59) unstable; urgency=medium
* Media types
bdfd714 Add media types and extensions to support ClickOnce apps.
* Documentation
77732bb Document how attacks with specially crafted file names are
prevented. Closes: #774303
4cd9ea4 Mention ~/.mailcap.order and better link between manpages.
Closes: #787459
* Packaging
8a8992d Remove obsolete arguments of dpkg-gencontrol.
a65e461 Pass --no-name to gzip, to make the build more reproducible.
Closes: #776939.
db49144 Make the mtimes reproducible. Closes: #793705
Thanks to Maria Valentina Marin <marivalenm@gmail.com>
-- Charles Plessy <plessy@debian.org> Mon, 03 Aug 2015 07:57:49 +0900
mime-support (3.58) unstable; urgency=high
* CVE-2014-7209: run-mailcap shell command injection.
Thanks to Timothy D. Morgan for the report.
d156797 Escape file name also when not passed through %s. This
avoids command injections using for instance semicolons.
b585022 Resolve file name to an absolute path to avoid injection of
command arguments with file names starting with dashes etc.
Use File::Spec to avoid race conditions with temporary files.
Thanks, Salvatore Bonaccorso for the patch.
-- Charles Plessy <plessy@debian.org> Sun, 28 Dec 2014 14:45:59 +0900
mime-support (3.57) unstable; urgency=medium
* Media types added:
ef09adf application/x-xz Closes: #756754
* Changed associations of file suffixes with media types:
94703d4 a/vnd.debian.binary-package: added ddeb, closes: #759746
* Other:
b412727 Document support for desktop entries.
Thanks to Andreas Metzler <ametzler@bebt.de>, closes: #749771
ce09266 Conforms to Policy 3.9.6.
-- Charles Plessy <plessy@debian.org> Sat, 04 Oct 2014 20:28:54 +0900
mime-support (3.56) unstable; urgency=medium
* Media types added:
e47e5a6 application/vnd.debian.binary-package
* Mailcap:
e47e5a6 Replaced a/x-debian-package with a/vnd.debian.binary-package.
-- Charles Plessy <plessy@debian.org> Sun, 25 May 2014 09:36:07 +0900
mime-support (3.55) unstable; urgency=low
* Media types removed:
92def2a application/x-font-woff Closes: #727156
c1797d2 application/x-md5 Closes: #720619
fad5967 application/x-sha1 Closes: #720619
a71f2b0 text/x-vcard Closes: #674670
* Media types added:
0d95409 application/font-sfnt
0d95409 application/font-tdpfr
0f12ec4 application/font-woff
020388a application/gzip Closes: #589991, 688872
77eee72 application/oebps-package+xml See: #712054
ae8262a application/x-font-pcf Closes: #727171
020388a application/zlib Closes: #589991, 688872
a71f2b0 text/vcard Closes: #674670
* Changed associations of file suffixes with media types:
ae8262a application/x-font: removed pcf extensions.
46df3ed application/vnd.visio: added vst vsw vss
1a69660 application/x-ns-proxy-autoconfig: removed dat, Closes: #418564
* Packaging:
b016fe8 Remove “see” alternative for “view”.
Thanks to Kevin Ryde <user42@zip.com.au>, Closes: #623384, #458691
c5b794b Removed obsolete removal of /usr/doc/mime-support.
* update-mime:
5448676 Accept file names with alphanumeric characters from the current
locale. Thanks to Tomás <tomas@tuxteam.de>, Closes: #682900
2a2243e Handle the “%c” (caption) field code from Desktop entry files.
Thanks to Philipp Matthias Hahn <pmhahn@debian.org>, Closes: #745153
c0e8e69 Handle the “%i” (icon) field code from Desktop entry files.
5cf809c Stop quoting “%s” when building /etc/mailcap from the files in
/usr/lib/mime/packages.
Thanks to Peter Chubb <peter.chubb@nicta.com.au>, Closes: #747050
f18b89f Warn when mailcap.order refers to packages that do not provide
mailcap files. Closes: #314952
7b1947f Reject lines that do not start with a media type. Closes: #384161
This drops support for continuation lines in /usr/lib/mime/packages/.
* run-mailcap:
3c3b56c Redirect stdin to the tty when a mailcap entry says needsterminal.
Thanks Kevin Ryde <user42@zip.com.au>, Closes: #727173
80a1bc7 Remove unreliable permission check. Closes: #691247 thanks to
Martin Mares <mj@ucw.cz> and Kevin Ryde <user42@zip.com.au>.
e833a8a Stricter pattern for detection of manual pages.
Thanks to Philipp Janda, LP: #1300484
40f72a7 Force the use of a temporary alias for files containing a space in
their name. Closes: #723708 thanks to Kevin Ryde <user42@zip.com.au>.
642d6a9 Remind of RFC 1524 in the “SEE ALSO” section of mailcap(5) man page.
Closes: #634254
dd293ec Run the “file“ command when extension does not tell the media type.
Thanks to Reuben Thomas <rrt@sc3d.org>, Closes: #77985
56dba74 Remove last-resort guesses of crontabs and man pages.
-- Charles Plessy <plessy@debian.org> Wed, 07 May 2014 07:03:23 +0900
mime-support (3.54) unstable; urgency=low
......@@ -194,7 +356,7 @@ mime-support (3.40-1) unstable; urgency=medium
mime-support (3.39-1) unstable; urgency=medium
* added new mime.types
* added new mime.types
-- Brian White <bcwhite@pobox.com> Mon, 4 Dec 2006 22:22:38 -0500
......@@ -485,7 +647,7 @@ mime-support (3.7-1) unstable; urgency=low
* fixed problem with run-mailcap extracting tests from mailcap (Bug#39877)
* added support for bzip/bzip2 (Bug#42022)
-- Brian White <bcwhite@pobox.com> Fri, 27 Aug 1999 14:27:44 -0400
......
Source: mime-support
Maintainer: Mime-Support Maintainers <mime-support@plessy.org>
Uploaders: Laszlo Boszormenyi (GCS) <gcs@debian.hu>,
Charles Plessy <plessy@debian.org>
Maintainer: Mime-Support Packagers <team+debian-mimesupport-packagers@tracker.debian.org>
Uploaders: Charles Plessy <plessy@debian.org>
Section: net
Priority: standard
Standards-Version: 3.9.5
Vcs-Browser: http://anonscm.debian.org/gitweb/?p=collab-maint/mime-support.git
Vcs-Git: git://anonscm.debian.org/collab-maint/mime-support.git
Standards-Version: 4.3.0
Vcs-Browser: https://salsa.debian.org/debian/mime-support
Vcs-Git: https://salsa.debian.org/debian/mime-support.git
Package: mime-support
Architecture: all
Multi-Arch: foreign
Recommends: file
Recommends: bzip2,
file,
xz-utils
Description: MIME files 'mime.types' & 'mailcap', and support programs
As these files can be used by all MIME compliant programs, they
have been moved into their own package that others can depend upon.
......
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Source: git://anonscm.debian.org/collab-maint/mime-support.git
Files: *
......@@ -9,3 +9,19 @@ License: ad-hoc
.
The "update-mime" program was written by Brian White and has been
placed in the public domain.
Files: mailcap.man
Copyright: (c) 1991 Bell Communications Research, Inc. (Bellcore)
License: Bellcore
Permission to use, copy, modify, and distribute this material
for any purpose and without fee is hereby granted, provided
that the above copyright notice and this permission notice
appear in all copies, and that the name of Bellcore not be
used in advertising or publicity pertaining to this
material without the specific, prior written permission
of an authorized representative of Bellcore. BELLCORE
MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY
OF THIS MATERIAL FOR ANY PURPOSE. IT IS PROVIDED "AS IS",
WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
Comment: Author: Nathaniel S. Borenstein
include:
- https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/salsa-ci.yml
- https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/pipeline-jobs.yml
variables:
RELEASE: 'unstable'
#! /bin/sh -e
#! /bin/sh
set -e
# dpkg triggers support for update-mime
if [ "$1" = "triggered" ]; then
test -x /usr/sbin/update-mime && /usr/sbin/update-mime --triggered
if which update-mime > /dev/null; then update-mime --triggered; fi
exit 0
fi
......@@ -13,13 +14,5 @@ rm -fr /var/lib/mime
rm -f /usr/sbin/install-mime
# Use "see" as alternative for "view"
update-alternatives \
--install /usr/bin/view view /usr/bin/see 1 \
--slave /usr/share/man/man1/view.1.gz view.1.gz /usr/share/man/man1/see.1.gz
# Run the update program
if [ -x /usr/sbin/update-mime ]; then
/usr/sbin/update-mime --triggered
fi
if which update-mime > /dev/null; then update-mime --triggered; fi
......@@ -2,11 +2,8 @@
#
# prerm file for mime-support
if [ \( "$1" = "upgrade" -o "$1" = "remove" \) -a -L /usr/doc/mime-support ]; then
rm -f /usr/doc/mime-support
fi
set -e
if [ "$1" = "remove" ]; then
update-alternatives --remove view /usr/bin/see
rm -f /etc/mailcap
fi
......@@ -6,7 +6,6 @@
package := mime-support
default:
@echo "Build 'binary' or 'clean'?"
@echo " "
......@@ -53,8 +52,8 @@ binary-indep:
install -m 755 debian/prerm debian/tmp/DEBIAN/prerm
install -m 644 debian/conffiles debian/tmp/DEBIAN/conffiles
install -m 644 debian/triggers debian/tmp/DEBIAN/triggers
cd debian/tmp/usr/share/man; gzip -9fv */*
cd debian/tmp/usr/share/doc/$(package); gzip -9v *
cd debian/tmp/usr/share/man; gzip --best --force --no-name --verbose */*
cd debian/tmp/usr/share/doc/$(package); gzip --best --no-name --verbose *
cd debian/tmp/usr/share/doc/$(package); gunzip copyright.gz
cd debian/tmp/usr/bin; ln -s run-mailcap see
cd debian/tmp/usr/bin; ln -s run-mailcap edit
......@@ -68,9 +67,11 @@ binary-indep:
(cd debian/tmp >/dev/null ; find . -type f ! -path "./etc/mime.types" ! -path "./etc/mailcap.order" ! -regex './DEBIAN/.*' -printf '%P\0' | LC_ALL=C sort -z | xargs -r0 md5sum > DEBIAN/md5sums) >/dev/null
chmod 644 debian/tmp/DEBIAN/md5sums
chown 0:0 debian/tmp/DEBIAN/md5sums
dpkg-gencontrol -is -ip
dpkg-gencontrol
chown -R root.root debian/tmp
chmod -R go=rX debian/tmp
find debian/tmp -newermt "@$$SOURCE_DATE_EPOCH" -print0 | \
xargs -0r touch --no-dereference --date="@$$SOURCE_DATE_EPOCH"
dpkg --build debian/tmp
dpkg-name -o -s .. debian/tmp.deb
......
###############################################################################
#
# MIME types and programs that process those types
# MIME media types and programs that process those types
#
# Much of this file is generated automatically by the program "update-mime".
# Please see the "update-mime" man page for more information.
......
application/x-debian-package; /usr/lib/mime/debian-view %s; needsterminal; description=Debian GNU/Linux Package; nametemplate=%s.deb; priority=0
application/vnd.debian.binary-package; /usr/lib/mime/debian-view %s; needsterminal; description=Debian GNU/Linux Package; nametemplate=%s.deb; priority=0
#audio/basic; /usr/lib/mime/playaudio %s; description=Basic uLaw Audio; nametemplate=%s.au; priority=0
......@@ -37,7 +37,7 @@ The "print=xxx" field is a command that is executed to print the data instead of
The "textualnewlines" field can be used in the rather obscure case where metamail's default rules for treating newlines in base64-encoded data are unsatisfactory. By default, metamail will translate CRLF to the local newline character in decoded base64 output if the content-type is "text" (any subtype), but will not do so otherwise. A mailcap entry with a field of "textualnewlines=1" will force such translation for the specified content-type, while "textualnewlines=0" will guarantee that the translation does not take place even for textual content-types.
The "compose" field may be used to specify a program that can be used to compose a new body or body part in the given format. Its intended use is to support mail composing agents that support the composition of multiple types of mail using external composing agents. As with the view-command, the compose command will be executed after replacing certain escape sequences starting with "%". In particular, %s should be replaced by the name of a file to which the composed data is to be written by the specified composing program, thus allowing th3e calling program (e.g. metamail) to tell the called program where to store the composed data. If %s does not appear, then the composed data will be assumed to be written by the composing programs to standard output. The result of the composing program may be data that is NOT yet suitable for mail transport -- that is, a Content-Transfer-Encoding may still need to be applied to the data.
The "compose" field may be used to specify a program that can be used to compose a new body or body part in the given format. Its intended use is to support mail composing agents that support the composition of multiple types of mail using external composing agents. As with the view-command, the compose command will be executed after replacing certain escape sequences starting with "%". In particular, %s should be replaced by the name of a file to which the composed data is to be written by the specified composing program, thus allowing the calling program (e.g. metamail) to tell the called program where to store the composed data. If %s does not appear, then the composed data will be assumed to be written by the composing programs to standard output. The result of the composing program may be data that is NOT yet suitable for mail transport -- that is, a Content-Transfer-Encoding may still need to be applied to the data.
The "composetyped" field is similar to the "compose" field, but is to be used when the composing program needs to specify the Content-type header field to be applied to the composed data. The "compose" field is simpler, and is preferred for use with existing (non-mail-oriented) programs for composing data in a given format. The "composetyped" field is necessary when the Content-type information must include auxiliary parameters, and the composition program must then know enough about mail formats to produce output that includes the mail type information, and to apply any necessary Content-Transfer-Encoding. Conceptually, "compose" specifies a program that simply outputs the specified type of data in its raw form, while "composetyped" specifies a program that outputs the data as a MIME object, with all necessary Content-* headers already in place.
......@@ -55,6 +55,9 @@ $HOME/.mailcap:/etc/mailcap:/usr/share/etc/mailcap:/usr/local/etc/mailcap -- def
.BR run-mailcap "(1)",
.BR mailcap.order "(5)",
.BR update-mime "(8)"
RFC 1524 (<http://tools.ietf.org/html/rfc1524>)
.SH COPYRIGHT
Copyright (c) 1991 Bell Communications Research, Inc. (Bellcore)
......
......@@ -88,6 +88,10 @@ rule comes
the emacs
.I edit
rule.
.SH "SEE ALSO"
.BR mailcap "(5)"
.BR run-mailcap "(1)"
.BR update-mime "(8)"
.SH AUTHOR
The
.B mailcap.order
......
......@@ -49,8 +49,10 @@ application/ecmascript es
application/edi-consent
application/edi-x12
application/edifact
application/epub+zip epub
application/eshop
application/font-tdpfr
application/font-sfnt otf ttf
application/font-tdpfr pfr
application/font-woff woff
application/futuresplash spl
application/ghostview
......@@ -70,7 +72,7 @@ application/isup
application/java-archive jar
application/java-serialized-object ser
application/java-vm class
application/javascript js
application/javascript js mjs
application/json json
application/m3g m3g
application/mac-binhex40 hqx
......@@ -87,7 +89,7 @@ application/news-message-id
application/news-transmission
application/ocsp-request
application/ocsp-response
application/octet-stream bin
application/octet-stream bin deploy msu msp
application/oda oda
application/oebps-package+xml opf
application/ogg ogx
......@@ -128,6 +130,7 @@ application/smil+xml smi smil
application/timestamp-query
application/timestamp-reply
application/vemmi
application/wasm wasm
application/whoispp-query
application/whoispp-response
application/wita
......@@ -164,6 +167,7 @@ application/vnd.cups-postscript
application/vnd.cups-raster
application/vnd.cups-raw
application/vnd.cybank
application/vnd.debian.binary-package deb ddeb udeb
application/vnd.dna
application/vnd.dpgraph
application/vnd.dxr
......@@ -185,6 +189,7 @@ application/vnd.eudora.data
application/vnd.fdf
application/vnd.ffsns
application/vnd.flographit
application/vnd.font-fontforge-sfd sfd
application/vnd.framemaker
application/vnd.fsc.weblaunch
application/vnd.fujitsu.oasys
......@@ -422,7 +427,8 @@ application/x-dms dms
application/x-doom wad
application/x-dvi dvi
application/x-executable
application/x-font pfa pfb gsf pcf pcf.Z
application/x-font pfa pfb gsf
application/x-font-pcf pcf pcf.Z
application/x-freemind mm
application/x-futuresplash spl
application/x-ganttproject gan
......@@ -465,6 +471,8 @@ application/x-lzx lzx
application/x-maker frm maker frame fm fb book fbdoc
application/x-mif mif
application/x-mpegURL m3u8
application/x-ms-application application
application/x-ms-manifest manifest
application/x-ms-wmd wmd
application/x-ms-wmz wmz
application/x-msdos-program com exe bat dll
......@@ -487,7 +495,6 @@ application/x-rx
application/x-scilab sci sce
application/x-scilab-xcos xcos
application/x-sh sh
application/x-sha1 sha1
application/x-shar shar
application/x-shellscript
application/x-shockwave-flash swf swfl
......@@ -514,6 +521,7 @@ application/x-x509-ca-cert crt
application/x-xcf xcf
application/x-xfig fig
application/x-xpinstall xpi
application/x-xz xz
audio/32kadpcm
audio/3gpp
......@@ -618,6 +626,13 @@ chemical/x-vmd vmd
chemical/x-xtel xtel
chemical/x-xyz xyz
font/collection ttc
font/otf ttf otf
font/sfnt ttf otf
font/ttf ttf otf
font/woff woff
font/woff2 woff2
image/cgm
image/g3fax
image/gif gif
......@@ -727,6 +742,7 @@ text/h323 323
text/html html htm shtml
text/iuls uls
text/mathml mml
text/markdown md markdown
text/parityfec
text/plain asc txt text pot brf srt
text/prs.lines.tag
......
This diff is collapsed.
......@@ -30,14 +30,18 @@ its encoding (e.g. compression), and filename together, separated by
colons. If the mime-type is omitted, an attempt to determine the type
is made by trying to match the file's extension with those in the
.I mime.types
files. If the encoding is omitted, it will also be determined from
the file's extensions. Currently supported encodings are
files. If no mime-type is found, a last attempt will be done by
running the
. B file
command, if available. If the encoding is omitted, it will also be
determined from the file's extensions. Currently supported encodings
are
.B gzip
(.gz),
.B bzip
(.bz),
.B bzip2
(.bz2), and
(.bz2),
.B xz
(.xz), and
.B compress
(.Z). A filename of "-" can be used to mean "standard input", but
then a mime-type
......@@ -75,7 +79,17 @@ Ignores any "copiousoutput" directive and sends output to STDOUT.
.TP
.BI \-\-norun
Displays the found command without actually executing it.
.SH SECURITY
A temporary copy of the file is opened if the file name matches the Perl
regular expression "[^[:alnum:],.:/@%^+=_-]", in order to protect from the
injection of shell commands, and to make sure that the name can always be
displayed in the current locale. In addition, the file is opened using its
absolute path to prevent the injection of command-line arguments, for instance
using file names starting with dashes.
.SH "SEE ALSO"
.BR file "(1)"
.BR mailcap "(5)"
.BR mailcap.order "(5)"
.BR update-mime "(8)"
.SH AUTHOR
.B run-mailcap
......
......@@ -14,20 +14,23 @@
umask(022);
# These are pretty well always a Good Idea(tm)
use strict;
use warnings;
#
# Program Constants
#
$debug = 0;
$conffile = "/etc/update-mime.conf";
$mailcap = "/etc/mailcap";
$mailcapdef = "/usr/lib/mime/mailcap";
$mimedir = "/usr/lib/mime/packages";
$appsdir = "/usr/share/applications";
$orderfile = "/etc/mailcap.order";
$defpriority = 5;
$localgen = 0;
my $debug = 0;
my $conffile = "/etc/update-mime.conf";
my $mailcap = "/etc/mailcap";
my $mailcapdef = "/usr/lib/mime/mailcap";
my $mimedir = "/usr/lib/mime/packages";
my $appsdir = "/usr/share/applications";
my $orderfile = "/etc/mailcap.order";
my $defpriority = 5;
my $localgen = 0;
# If the call comes from dpkg, only accept it if --triggered is passed
......@@ -60,19 +63,19 @@ do $conffile if -f $conffile;
#
# Global Variables
#
%entries;
%packages;
%priorities;
@order;
$counter=1;
my %entries;
my %packages;
my %priorities;
my @order;
my $counter=1;
sub ReadEntries
{
my($pkg,$priority);
# foreach $file (glob "$mimedir/*") {
foreach $file (map { glob $_.'/*' } split ':',$mimedir) {
# foreach my $file (glob "$mimedir/*") {
foreach my $file (map { glob $_.'/*' } split ':',$mimedir) {
next if ($file =~ m!(^|/)(\.|\#)|(\~)$!);
($pkg) = ($file =~ m|/([^/]*)$|);
print STDERR "$pkg:\n" if $debug;
......@@ -85,6 +88,10 @@ sub ReadEntries
while (<FILE>) {
chomp;
next if m/^\s*$|^\s*\#/;
if (! m(^[a-zA-Z0-9*][a-zA-Z0-9!#\$&^_.+-]*/[a-zA-Z0-9*][a-zA-Z0-9!#\$&^_.+-]*;) ) {
print STDERR "Warning: mailcap line not starting with a media type in $pkg\n";
print STDERR "Problematic line: $_\n";
}
if (m/priority\s*=\s*(\d+)\s*($|;)/i) {
$priority=$1;
} else {
......@@ -95,7 +102,6 @@ sub ReadEntries
print STDERR " $_\n";
$priority=$defpriority;
}
s/([^\s;]\s+)(?![\'\"])([^\s;]*)%s([^\s;]*)/$1'$2%s$3'/g;
$entries{$counter} = $_;
push @{$packages{$pkg}},$counter;
push @{$priorities{$priority}},$counter;
......@@ -125,7 +131,7 @@ sub ReadDesktopEntries
{
my($pkg,$priority);
foreach $file (RecurseIntoDirectories(split ':',$appsdir)) {
foreach my $file (RecurseIntoDirectories(split ':',$appsdir)) {
next if ($file =~ m!(^|/)(\.|\#)|(\~)$!);
next unless ($file =~ m/\.desktop$/);
($pkg) = ($file =~ m|/([^/]*)\.desktop$|);
......@@ -135,13 +141,19 @@ sub ReadDesktopEntries
$packages{$pkg} = [];
if (open(FILE,"<$file")) {
my($terminal, $exec, @types) = ("test=test -n \"\$DISPLAY\"");
my($terminal, $name, $icon, $exec, @types) = ("test=test -n \"\$DISPLAY\"", $pkg);
while (<FILE>) {
chomp;
next if (m/^\s*$|^\s*\#/);
if (m/^Terminal=(\w+)/i) {
$terminal = "needsterminal" if ($1 eq "true");
}
elsif (m/^Name=(.+)/i) {
$name = $1;
}
elsif (m/^Icon=(.+)/i) {
$icon = $1;
}
elsif (m/Exec=(.*)$/i) {
$exec = $1;
$exec =~ s/%[fFuU]/%s/g;
......@@ -155,7 +167,9 @@ sub ReadDesktopEntries
close(FILE);
next;
}
foreach $type (@types) {
$exec =~ s/%c/$name/g;
$exec =~ s/%i/--icon $icon/g;
foreach my $type (@types) {
my $entry = "$type; $exec; $terminal";
$priority=$defpriority;
$entries{$counter} = $entry;
......@@ -181,6 +195,11 @@ sub ReadOrder
s/\s*\#.*$//;
next if m/^\s*$/;
push @order,$_;
/(.*):/;
my $pkg = $1;
unless( grep {/^$pkg$/} keys(%packages)) {
print STDERR "Warning: package $pkg listed in /etc/mailcap.order does not have mailcap entries.\n";
}
}
close(FILE);
} else {
......@@ -199,17 +218,17 @@ sub OrderEntries
print STDERR " - Priority $priority:" if $debug;
@templist = @{$priorities{$priority}};
@templist = sort {
$ae = $entries{$a};
$ac = 0;
my $ae = $entries{$a};
my $ac = 0;
$ac += 1 if $ae =~ m!^\S+/\*!;
$ac += 2 if $ae =~ m!^\*/!;
$be = $entries{$b};
$bc = 0;
my $be = $entries{$b};
my $bc = 0;
$bc += 1 if $be =~ m!^\S+/\*!;
$bc += 2 if $be =~ m!^\*/!;
$ac <=> $bc;
} @templist;
foreach $entry (@templist) {
foreach my $entry (@templist) {
print STDERR " $entry" if $debug;
push @entrylist,$entry;
}
......@@ -232,7 +251,7 @@ sub OrderEntries
next if grep(/^\Q$entrycode\E$/,@orderlist);
print STDERR " - Checking entrycode '$entrycode' against (@{$packages{$pkg}})...\n" if $debug;
if (grep(/^\Q$entrycode\E$/,@{$packages{$pkg}})) {
$entry = $entries{$entrycode};
my $entry = $entries{$entrycode};
my($etype) = ($entry =~ m/^(.*?)(;|\s)/);
print STDERR " - entry found, type=$etype, checking against '$typ'\n" if $debug;
if ($etype =~ m!^$typ$!) {
......@@ -332,5 +351,5 @@ sub UpdateMailcap
ReadEntries();
ReadDesktopEntries();
ReadOrder();
@list = OrderEntries();
my @list = OrderEntries();
UpdateMailcap(@list);
......@@ -18,9 +18,15 @@ installation or removal.
.SS OPTIONS
.BI \-\-local
Generate files in the current user's home directory instead of /etc.
This allows users to create a custom ordering configuration and get
a complete ~/.mailcap file out of it.
Generate files in the current user's home directory instead of the
.I /etc
directory. This allows users to create a custom ordering configuration and get
a complete
.I ~/.mailcap
file out of it. In this local mode, the order overriding file (see below)
will be looked for in the
.I ~/.mailcap.order
file.
.SH OVERRIDING ORDER
The order of entries in the
......@@ -63,7 +69,7 @@ that rule a "last resort".
.TP
.BI <program-string>
Specifies the program to run to view a file of the given content-type.
.B This option setting connot be omitted.
.B This option setting cannot be omitted.
An implicit "view=" can be considered before it. When writing an
entry that has no viewer, use a value of
.I false
......@@ -180,6 +186,13 @@ will cause
.B update\-mime
to be automatically run via a Dpkg trigger.
.SH DESKTOP ENTRIES
In addition to the abovementioned mechanism
.B update\-mime
also parses desktop entries in /usr/share/applications/ to generate
mailcap entries. These entries are given a lower priority than those
in /usr/lib/mime/packages.
.SH "SEE ALSO"
.BR mailcap.order "(5), "deb-triggers "(1), RFC-2046, RFC-1524
.SH AUTHOR
......