Summary: | PIE executables (e.g. /usr/bin/ls) are detected as application/x-sharedlib | ||
---|---|---|---|
Product: | shared-mime-info | Reporter: | David Faure <faure> |
Component: | freedesktop.org.xml | Assignee: | Shared Mime Info group <shared_mime_info> |
Status: | RESOLVED MOVED | QA Contact: | |
Severity: | normal | ||
Priority: | medium | CC: | alan.coopersmith, andrey.vihrov, dkg, yann |
Version: | unspecified | ||
Hardware: | Other | ||
OS: | All | ||
See Also: | https://bugs.gw.com/view.php?id=404 | ||
Whiteboard: | |||
i915 platform: | i915 features: |
Description
David Faure
2016-08-06 13:12:36 UTC
Or you could just dump the file into the staging-tests/ directory, and run "make local-test". Patch welcome, but I wonder how useful that magic (or lack of accuracy) actually is. Well we need a way to find out that /bin/ls is an executable, and there's no extension, so working magic would be useful ;) However I don't know anything about the ELF file format, so I don't know what the problem actually is (and whether it offers reliable magic). Admittedly the magic for x-sharedlib is the one that's much less useful, shared libs are typically called *.so or *.so.[0-9\.]* :-) But I wouldn't dare just removing all magic from x-sharedlib... unless someone can prove that the ELF file format makes no actual difference between shared libs and executables? The ELF file format distinguishes between traditional executables and shared objects, but unfortunately PIE executables are treated as ELF shared objects AFAIK, a shared object could be a PIE program if it has a (valid) interpretor header (PT_INTERP). It should be noted that glibc's ELF loader (ld-linux.so, exact name depending on architecture) is a shared object and a valid program, but doesn't have an interpretor header, but that's the only exception I aware of. IOTH, glibc's libc.so is a shared object with a valid interpretor, making it a valid program (try it !). Reporting such library as a program might be misleading for end user. Anyway, PT_INTERP header not at a fixed location in the ELF file, so it cannot be described in shared-mime-info database. (It's a pity PIE ELF files were not describe with a new ELF type or at least a flag :( This has been open for over a year, and is related to even older bugs in tools that depend on shared-mime-info (e.g. https://bugzilla.gnome.org/show_bug.cgi?id=737849 ). This is also an issue in libmagic, and there is more discussion about ELF over there: https://bugzilla.redhat.com/show_bug.cgi?id=1296868 It'd be great to have some sort of resolution here. (In reply to Daniel Kahn Gillmor from comment #5) > It'd be great to have some sort of resolution here. That's not going to happen unless somebody has a patch. Reading comment 4, that seems unlikely. If you have applications that require this deep level of knowledge of the different formats, you'll probably want to use something more precise than the shared-mime spec. -- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/xdg/shared-mime-info/issues/11. |
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.