https://redmine.lighttpd.net/https://redmine.lighttpd.net/favicon.ico?13667327412019-03-14T02:37:22Zlighty labsLighttpd - Feature #2942: incorrect behaviour of create-mime.assign.plhttps://redmine.lighttpd.net/issues/2942?journal_id=117152019-03-14T02:37:22Zgeusebi
<ul><li><strong>File</strong> <a href="/attachments/1933">create-mime.assign.py</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/1933/create-mime.assign.py">create-mime.assign.py</a> added</li></ul><p>Updated the python version to exit immediately when mime.types is not readable.</p> Lighttpd - Feature #2942: incorrect behaviour of create-mime.assign.plhttps://redmine.lighttpd.net/issues/2942?journal_id=117162019-03-14T05:34:49Zgstrauss
<ul><li><strong>Tracker</strong> changed from <i>Bug</i> to <i>Feature</i></li><li><strong>Status</strong> changed from <i>New</i> to <i>Invalid</i></li></ul><blockquote>
<p>1. mimetype could contain a comma,</p>
</blockquote>
<p>How is this a "problem"? The character class containing [+-.] is not what was intended, but happens to contain '+' ',' '-' '.' so actually matches all intended characters plus ',' That a mime type could contain a comma and still be parsed should not cause any problems. After all, that would need to be present in /etc/mime.types.</p>
<blockquote>
<p>2. uppercase characters makes an entire rule to fail,</p>
</blockquote>
<p>Did you test that? The regex ends in /i so it is a case-insensitive match.</p>
<blockquote>
<p>3. lines which ends with a slash aren't joined to following lines,</p>
</blockquote>
<p>Is there a distro which does this that you could point to as an example? This would be a limitation, not a bug.</p>
<blockquote>
<p>4. some special character is not recognized.</p>
</blockquote>
<p>This is also a limitation, not a bug. Is there a distro that ships with mime.types containing special characters, or is that something you added? You can configure any valid extension chars in <code>mimetype.assign</code> if you list them explicitly.</p>
<p>.</p>
<p>Is there a reason that you posted python code which does not reimplement all the features of the existing script?</p> Lighttpd - Feature #2942: incorrect behaviour of create-mime.assign.plhttps://redmine.lighttpd.net/issues/2942?journal_id=117172019-03-14T15:13:14Zgeusebi
<ul></ul><p><strong>Sorry to have wasted your time, it wasn't my intention.</strong><br /><strong>You are right.</strong></p>
<p>I've installed lighttpd (version 1.4.45) with apt in a clean Debian 9.6.</p>
<p>And this is the file I found installed (see at end of this post).<br />I, wrongly, assumed it was coming from the official lighttpd repository. It's my fault.<br />The reason of the python script was that I noticed that some extensions where missing (the ones with uppercase characters). So, I tried to reimplement it in python while reading the perl code below and also "man mime.types". Which I now realize was from CUPS, a more complex file format which I should have ignored (again, sorry).</p>
<p>For point number 4: apparently, the very debian version on which I installed lighttpd ships:<br /><pre>
user:~# cat /etc/mime.types | grep x-trash
application/x-trash ~ % bak old sik
</pre><br />Here you can see the special characters. And you're right I can add them explicitly.</p>
<p>Point number 3: (backslash) was mentioned in the manual of 'mime.types' (to be ignored since it's from CUPS):<br /><pre>
Rules can be extended over multiple lines using the backslash character
(\):
mime/type [ really-really-really-long-rule ... \
rule ]
</pre></p>
<p>File 'create-mime.assign.pl' on Debian 9.6 lighttpd 1.4.45. <br /><pre><code class="text syntaxhl" data-language="text">user:~# cat /usr/share/lighttpd/create-mime.assign.pl
#!/usr/bin/perl -w
use strict;
open MIMETYPES, "/etc/mime.types" or exit;
print "mimetype.assign = (\n";
my %extensions;
while(<MIMETYPES>) {
chomp;
s/\#.*//;
next if /^\w*$/;
if(/^([a-z0-9\/+-.]+)\s+((?:[a-z0-9.+-]+[ ]?)+)$/) {
foreach(split / /, $2) {
# mime.types can have same extension for different
# mime types
next if $extensions{$_};
$extensions{$_} = 1;
print "\".$_\" => \"$1\",\n";
}
}
}
print ")\n";
</code></pre></p>
<p>Thanks again,<br />GEusebi</p> Lighttpd - Feature #2942: incorrect behaviour of create-mime.assign.plhttps://redmine.lighttpd.net/issues/2942?journal_id=117182019-03-15T01:36:25Zgstrauss
<ul></ul><p>There have been over 625 commits to lighttpd source code between the release of lighttpd 1.4.45 and up through lighttpd 1.4.53. The Debian Stretch package of lighttpd is woefully out of date, and that is unfortunately a problem in Debian, not in lighttpd. The <strong>Debian</strong> lighttpd package maintainers went AWOL. It took some effort to get other Debian developers to mark the package as orphaned in Debian.</p>
<p>Recently, Helmut Grohne put in quite a bit of effort getting the lighttpd Debian package back into shape for Debian Buster.</p>
<p>In Debian Buster, Debian uses the create-mime.assign.pl from the lighttpd repository. This was committed 3 months ago<br /><a class="external" href="https://salsa.debian.org/debian/lighttpd/commit/62dd0924e74b14ab8b14c7a64e8b449b98656333">https://salsa.debian.org/debian/lighttpd/commit/62dd0924e74b14ab8b14c7a64e8b449b98656333</a><br />and fixed Debian bug <a class="external" href="https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=904741">https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=904741</a></p>
<p>The long and short is this: in order not to waste <strong>your time</strong> (or mine), if you report bugs on the official lighttpd site, please check that the bug still exists in the latest official version of lighttpd. If a bug is specific to your distro of choice, then please check the distro to see if the package management has addressed the issue, or if the issue is with the distro package management rather than in the official lighttpd release.</p>
<p>You can hopefully see that we try look into and respond to bug reports reasonably quickly. However, nobody likes to waste time on things that have been fixed months or years ago. Users don't like to repeatedly trip over things that have been fixed long ago, and developers don't like to re-troubleshoot things that have been fixed long ago. This problem can be avoided with good package maintainers in each widely used distro.</p>
<p>Please consider filing feature requests for enhancements, not bug reports. If you are not sure if something is a bug or a feature, you should probably err on the side of making a feature request. I don't think that supporting application/x-trash is a bug. First, create-mime.assign.pl is an optional helper script. Second, application/x-trash, as you might imagine, is not an official IANA-registered MIME type. <a class="external" href="https://www.iana.org/assignments/media-types/media-types.xhtml">https://www.iana.org/assignments/media-types/media-types.xhtml</a></p> Lighttpd - Feature #2942: incorrect behaviour of create-mime.assign.plhttps://redmine.lighttpd.net/issues/2942?journal_id=117202019-03-15T23:26:04Zgeusebi
<ul></ul><p>I'll keep everything you said in mind the next time I'll file a bug report here or elsewhere.</p>
<p>I must say that you've been very quick and clear in your response.<br />Thank you for your answers and many thanks to all the team for lighttpd. I just started using it and it looks like a great web server.</p>
<p>GEusebi</p>