Commit 15fb9891 authored by David Faure's avatar David Faure

Rmove ELF magic for application/x-sharedlib, generalize x-executable magic.

PIE executables have the same header as ELF shared libs and therefore
were being detected as shared libraries.

The magic for executables was too specific, I removed the check
for the value at offset 16 since it's actually 3 for /usr/bin/ls, not 2.

Fixes gitlab issue #11.
#11
parent 6bf9e4ff
Pipeline #160360 passed with stage
in 1 minute and 32 seconds
......@@ -1998,14 +1998,10 @@ command to generate the output files.
<generic-icon name="application-x-executable"/>
<magic priority="40">
<match type="string" value="\177ELF" offset="0">
<match type="byte" value="1" offset="5">
<match type="little16" value="2" offset="16"/>
</match>
<match type="byte" value="1" offset="5"/>
</match>
<match type="string" value="\177ELF" offset="0">
<match type="byte" value="2" offset="5">
<match type="big16" value="2" offset="16"/>
</match>
<match type="byte" value="2" offset="5"/>
</match>
<match type="string" value="MZ" offset="0"/>
<match type="little16" value="0x521c" offset="0"/>
......@@ -3571,20 +3567,9 @@ command to generate the output files.
<mime-type type="application/x-sharedlib">
<comment>shared library</comment>
<magic priority="50">
<match type="string" value="\177ELF" offset="0">
<match type="byte" value="1" offset="5">
<match type="little16" value="3" offset="16"/>
</match>
</match>
<match type="string" value="\177ELF" offset="0">
<match type="byte" value="2" offset="5">
<match type="big16" value="3" offset="16"/>
</match>
</match>
<match type="little16" value="0603" offset="0">
<match type="little16" mask="030000" value="020000" offset="22"/>
</match>
<match type="string" mask="0xffffffff000000000000000000000000ff" value="\177ELF \003" offset="0"/>
</magic>
<glob pattern="*.so"/>
</mime-type>
......
......@@ -671,6 +671,10 @@ LiberationSans-Regular.woff font/woff
nrl.trig application/trig oxo
# Copied from http://git.savannah.gnu.org/cgit/gnash.git/plain/testsuite/samples/subshapes.swf
subshapes.swf application/vnd.adobe.flash.movie
# PIE executable https://gitlab.freedesktop.org/xdg/shared-mime-info/-/issues/11
ls application/x-executable x
hello.xdgapp application/vnd.flatpak
hello.flatpak application/vnd.flatpak
gnome.flatpakrepo application/vnd.flatpak.repo
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment