V Wed, Sep 22, 2021 at 12:47:07PM -0400, Steve Grubb napsal(a):
I find the file utility to be almost reliable. It changes how it identifies ELF files every couple releases. So, to stabilize this, fapolicyd-cli uses it's own logic to determine what kind of ELF file it finds. I also regularly find text/plain files where it cannot identify the language and files that are application/octet-stream which are also misidentified.
File's libmagic will always misdetect some files.
I'd like to see rpmbuild to prefer user.mime_type extended attribute over libmagic guess. That way packagers could override the MIME type directly from a spec file:
%install setfattr -n 'user.mime_type' -v 'text/x-perl' %{buildroot}%{_bindir}/GET
If rpmbuild carried that attribute to RPM archive, rpm would set the attribute when installing that package and it would become available to other tools like fapolicyd-cli.
Technically we could patch libmagic to do that, but I feel that libmagic upstream wouldn't like that. Maybe a place for an intermediate wrapper.
-- Petr
packaging@lists.fedoraproject.org