Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 762964 - www-servers/nginx: bundled mime.types file has poor coverage
Summary: www-servers/nginx: bundled mime.types file has poor coverage
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: No maintainer - Look at https://wiki.gentoo.org/wiki/Project:Proxy_Maintainers if you want to take care of it
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2021-01-01 20:07 UTC by kfm
Modified: 2022-10-23 20:24 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description kfm 2021-01-01 20:07:13 UTC
The mime.types file bundled by nginx has poor media type coverage.

# types() { awk '/\// { print $1 }' "$@" | sort -u; }
# types /etc/nginx/mime.types | wc -l
80

Now let's look at the mime.types file provided by app-misc/mime-types.

# types /etc/mime.types | wc -l
1918

That's quite a discrepancy. Of course, total numbers don't tell the whole story. Let's consider which media types appear in /etc/nginx/mime.types that do not appear in /etc/mime.types.

# grep -vxFf <(types /etc/mime.types) <(types /etc/nginx/mime.types) 
application/x-cocoa
application/x-java-archive-diff
application/x-makeself
application/x-perl
application/x-pilot
application/x-sea
audio/x-m4a
font/woff
font/woff2

Of these 9, all appear to be non-standard except for font/woff and font/woff2, per RFC8081. However, this could be addressed by issuing a much-needed update to app-misc/mime-types itself.

In Summary, I think that Gentoo could benefit enormously from adopting the approach of several other distributions, whereby the default nginx config references a set of media types that is standardised and subjected to routine maintenance, rather than the limited set provided by the nginx sources.

To provide but one example, Arch Linux not only provides /etc/mime.types from the upstream mailcap project, but also uses its bundled script to generate an /etc/nginx/mime.types file that is suitable for inclusion by the default /etc/nginx/nginx.conf. Aside from providing better coverage, it allows for the list of media types to be kept in sync with IANA without necessarily having to update nginx itself.

See also, bug 762958.
Comment 1 Eray Aslan gentoo-dev 2022-06-06 02:48:00 UTC
(In reply to Kerin Millar from comment #0)
> To provide but one example, Arch Linux not only provides /etc/mime.types
> from the upstream mailcap project, but also uses its bundled script to
> generate an /etc/nginx/mime.types file that is suitable for inclusion by the
> default /etc/nginx/nginx.conf. Aside from providing better coverage, it
> allows for the list of media types to be kept in sync with IANA without
> necessarily having to update nginx itself.

I think that's the better approach as well. app-misc/mime-types[nginx] installs /etc/nginx/mime.types.nginx file. So two alternatives would be:

- RDEPEND on app-misc-mime-types[nginx] and change the nginx config file to use /etc/nginx/mime.types.nginx as default

- do not install /etc/nginx/mime.types file from nginx and RDEPEND on app-misc/mime-types[nginx] (and change the file location in mime-types ebuild to /etc/nginx/mime.types instead of /etc/nginx/mime.types.nginx and do not touch the default config file)
Comment 2 Larry the Git Cow gentoo-dev 2022-10-23 20:24:08 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fd0e508ff6bd477682cf8c156a23248808744e6d

commit fd0e508ff6bd477682cf8c156a23248808744e6d
Author:     Tomáš Mózes <hydrapolic@gmail.com>
AuthorDate: 2022-10-22 06:34:16 +0000
Commit:     Conrad Kostecki <conikost@gentoo.org>
CommitDate: 2022-10-23 20:23:00 +0000

    www-servers/nginx: various improvements
    
    - update nginx modules
    - change naxsi upstream as previous fails to build and is considered obsolete
    - use mime types from app-misc/mime-types by default
    
    Closes: https://bugs.gentoo.org/762964
    Closes: https://bugs.gentoo.org/836454
    Closes: https://bugs.gentoo.org/850571
    Signed-off-by: Tomáš Mózes <hydrapolic@gmail.com>
    Closes: https://github.com/gentoo/gentoo/pull/27887
    Signed-off-by: Conrad Kostecki <conikost@gentoo.org>

 www-servers/nginx/Manifest               |    6 +
 www-servers/nginx/files/nginx.conf-r3    |   70 ++
 www-servers/nginx/nginx-1.23.2-r1.ebuild | 1066 ++++++++++++++++++++++++++++++
 3 files changed, 1142 insertions(+)