diff options
author | David Faure <faure@kde.org> | 2020-06-13 15:30:53 +0200 |
---|---|---|
committer | David Faure <faure@kde.org> | 2020-06-13 15:31:09 +0200 |
commit | 15fb989154e0eacde8c63222b60f731ed7a462b1 (patch) | |
tree | 22dcd09390a697c9fdf69bc57c8fe829fccd8652 | |
parent | 6bf9e4ff0fb7eff11a02bd937045bf5dc291841a (diff) | |
download | shared-mime-info-15fb989154e0eacde8c63222b60f731ed7a462b1.tar.gz |
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.
https://gitlab.freedesktop.org/xdg/shared-mime-info/-/issues/11
-rw-r--r-- | data/freedesktop.org.xml.in | 19 | ||||
-rw-r--r-- | tests/mime-detection/list | 4 | ||||
-rw-r--r-- | tests/mime-detection/ls | bin | 0 -> 130792 bytes |
3 files changed, 6 insertions, 17 deletions
diff --git a/data/freedesktop.org.xml.in b/data/freedesktop.org.xml.in index 1c17b8d4..822c88cf 100644 --- a/data/freedesktop.org.xml.in +++ b/data/freedesktop.org.xml.in @@ -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> diff --git a/tests/mime-detection/list b/tests/mime-detection/list index 2384487a..76d4f957 100644 --- a/tests/mime-detection/list +++ b/tests/mime-detection/list @@ -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 diff --git a/tests/mime-detection/ls b/tests/mime-detection/ls Binary files differnew file mode 100644 index 00000000..eddc17b2 --- /dev/null +++ b/tests/mime-detection/ls |