On Monday 18 August 2008, you wrote: > On Mon, 2008-08-18 at 16:44 -0400, Matthias Clasen wrote: > > On Mon, 2008-08-18 at 20:08 +0200, David Faure wrote: > > > The spec currently says, about glob matching: > > > > > > "If several patterns match then the longest pattern SHOULD be used." > > > > > > With the recent addition of glob weights, this sentence is missing "... > > > of the same weight", isn't it? > > > > > > This way *.tar.bz2 is preferred over *.bz2 (as was the intent of this > > > sentence), > > > but still weights are obeyed, so that README.* loses to *.pdf > > > > > > > You are right, that should be clarified. > > Feel free to drop let me know what to change it to (bonus points for > patches), and I'll get Vincent to update it on the website after that.
Here's a patch with the changes I would suggest, please double-check and apply. -- David Faure, [EMAIL PROTECTED], sponsored by Trolltech to work on KDE, Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).
Index: shared-mime-info-spec.xml =================================================================== RCS file: /cvs/mime/shared-mime-info/shared-mime-info-spec.xml,v retrieving revision 1.62 diff -u -p -r1.62 shared-mime-info-spec.xml --- shared-mime-info-spec.xml 20 Jul 2008 15:35:40 -0000 1.62 +++ shared-mime-info-spec.xml 10 Sep 2008 08:54:54 -0000 @@ -467,8 +467,8 @@ This is so that <filename>main.C</filena but <filename>IMAGE.GIF</filename> will still use the *.gif pattern. </para> <para> -If several patterns match then the longest pattern SHOULD be used. In -particular, files with multiple extensions (such as +If several patterns of the same weight match then the longest pattern SHOULD be used. +In particular, files with multiple extensions (such as <filename>Data.tar.gz</filename>) MUST match the longest sequence of extensions (eg '*.tar.gz' in preference to '*.gz'). Literal patterns (eg, 'Makefile') must be matched before all others. It is suggested that patterns beginning with `*.' @@ -838,15 +838,17 @@ be used instead of guessing. </para></listitem> <listitem><para> -Otherwise, start by doing a glob match of the filename. If one or more glob matches, and all the -matching globs result in the same mimetype, use that mimetype as the result. +Otherwise, start by doing a glob match of the filename. Keep only globs with the biggest weight. +If the patterns are different, keep only globs with the longest pattern, as previously discussed. +If after this, there is one or more matching glob, and all the matching globs +result in the same mimetype, use that mimetype as the result. </para></listitem> <listitem><para> If the glob matching fails or results in multiple conflicting mimetypes, read the contents of the file and do magic sniffing on it. If no magic rule matches the data (or if the content is not available), use the default type of application/octet-stream for -binary data, or text/plain for textual data. If there was no glob match the magic match +binary data, or text/plain for textual data. If there was no glob match, use the magic match as the result. </para><para> Note: Checking the first 32 bytes of the file for ASCII control characters is
_______________________________________________ xdg mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/xdg
