Apache2 magic mime file is broken (2.4.52-1ubuntu4.2)
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
apache2 (Ubuntu) |
New
|
Undecided
|
Unassigned | ||
Jammy |
Incomplete
|
Undecided
|
Unassigned |
Bug Description
The default `/etc/apache2/
I don't know what exactly is the problem, but here are a few details that demonstrate that it is indeed broken:
* echo -e "<!DOCTYPE HTML>\nblah blah" > /tmp/foo
* file -m /etc/apache2/magic /tmp/foo
=> Shows a bunch of "string modifier `B' invalid" warnings
and finally: "could not find any valid magic files!"
* Trying to fetch this file via apache for a configuration that has "a2enmod mime_magic" results in no Content-Type header
* Now, get the original magic file from https:/
drop it in the same place:
=> the `file` command now works as expected,
=> fetching the file via apache has the expected Content-Type header
* Alternatively, modify the original magic file by removing all "B" modifiers
(on lines 187, 402, 403, 404, 405, 622, 627, 631, 632)
=> both the `file` command and the header from apache work
---
version information:
$ lsb_release -rd
Description: Ubuntu 22.04.1 LTS
Release: 22.04
$ apt-cache policy apache2
apache2:
Installed: 2.4.52-1ubuntu4.2
Candidate: 2.4.52-1ubuntu4.2
Version table:
*** 2.4.52-1ubuntu4.2 500
500 http://
100 /var/lib/
2.
500 http://
2.
500 http://
Changed in apache2 (Ubuntu Jammy): | |
status: | Triaged → Incomplete |
Thanks for reporting this bug and trying to make Ubuntu better.
I tried to reproduce what you described in a Ubuntu Jammy container:
root@apache2- jammy:~ # dpkg -l apache2 Unknown/ Install/ Remove/ Purge/Hold Not/Inst/ Conf-files/ Unpacked/ halF-conf/ Half-inst/ trig-aWait/ Trig-pend /Reinst- required (Status,Err: uppercase=bad) ======= ====-== ======= ======= =-===== ======= -====== ======= ======= ======= => jammy:~ # cat /tmp/foo jammy:~ # file -m /etc/apache2/magic /tmp/foo jammy:~ # wget https:/ /raw.githubuser content. com/apache/ httpd/trunk/ docs/conf/ magic /raw.githubuser content. com/apache/ httpd/trunk/ docs/conf/ magic ontent. com (raw.githubuser content. com)... 185.199.108.133, 185.199.109.133, 185.199.110.133, ... ontent. com (raw.githubuser content. com)|185. 199.108. 133|:443. .. connected.
Desired=
| Status=
|/ Err?=(none)
||/ Name Version Architecture Description
+++-===
ii apache2 2.4.52-1ubuntu4.2 amd64 Apache HTTP Server
root@apache2-
<!DOCTYPE HTML>
blah blah
root@apache2-
/etc/apache2/magic, 187: Warning: string modifier `B' invalid
/etc/apache2/magic, 402: Warning: string modifier `B' invalid
/etc/apache2/magic, 619: Warning: string modifier `B' invalid
/etc/apache2/magic, 624: Warning: string modifier `B' invalid
/etc/apache2/magic, 628: Warning: string modifier `B' invalid
/etc/apache2/magic, 629: Warning: string modifier `B' invalid
file: could not find any valid magic files!
root@apache2-
--2023-01-24 20:29:34-- https:/
Resolving raw.githubuserc
Connecting to raw.githubuserc
HTTP request sent, awaiting response... 200 OK
Length: 13064 (13K) [text/plain]
Saving to: ‘magic’
magic 100%[== ======= ======= ==>] 12.76K --.-KB/s in 0.001s
2023-01-24 20:29:35 (9.45 MB/s) - ‘magic’ saved [13064/13064]
root@apache2- jammy:~ # file -m ./magic /tmp/foo
/tmp/foo: text/html
The file shipped in the Ubuntu package diverges from the upstream one. This requires extra investigation to understand why this was done. Adding this bug to our backlog.