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 Desired=Unknown/Install/Remove/Purge/Hold | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad) ||/ Name Version Architecture Description +++-==============-=================-============-============================> ii apache2 2.4.52-1ubuntu4.2 amd64 Apache HTTP Server root@apache2-jammy:~# cat /tmp/foo <!DOCTYPE HTML> blah blah root@apache2-jammy:~# file -m /etc/apache2/magic /tmp/foo /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-jammy:~# wget https://raw.githubusercontent.com/apache/httpd/trunk/docs/conf/magic --2023-01-24 20:29:34-- https://raw.githubusercontent.com/apache/httpd/trunk/docs/conf/magic Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.108.133, 185.199.109.133, 185.199.110.133, ... Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.108.133|:443... connected. 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. ** Also affects: apache2 (Ubuntu Jammy) Importance: Undecided Status: New ** Changed in: apache2 (Ubuntu Jammy) Status: New => Triaged -- You received this bug notification because you are a member of Ubuntu Server/Client Support Team, which is subscribed to apache2 in Ubuntu. Matching subscriptions: Ubuntu Server/Client Support Team https://bugs.launchpad.net/bugs/2003709 Title: Apache2 magic mime file is broken (2.4.52-1ubuntu4.2) To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/apache2/+bug/2003709/+subscriptions -- Mailing list: https://launchpad.net/~enterprise-support Post to : enterprise-support@lists.launchpad.net Unsubscribe : https://launchpad.net/~enterprise-support More help : https://help.launchpad.net/ListHelp