GNOME Bugzilla – Bug 571377
Not running executable file of MIME type application/x-extension-bin
Last modified: 2018-01-28 11:35:30 UTC
Please describe the problem: Nautilus does not execute files with executable flag set if files have a "." in the name. Something like -rwxr-xr-x AdobeAirInstaller will be executed, but -rwxr-xr-x AdobeAirInstaller.bin will fail with message saying: No application installed for this file type. Therefore, Nautilus totally disregards the executable flag set on files. Steps to reproduce: 1. Download/Create a binary executable or create a script 2. Name or rename it something.bin 3. Set the executable flag 4. Double click the file Actual results: Message saying: No application installed for this file type. Expected results: The file is executed, maybe with an opened console or terminal, in case of shell scripts... Does this happen every time? YES Other information:
For me this bug doesn't affect all files that contain a . but definitely all files that end in .bin
Affected are .bin files of the type 'application/x-extension-bin'. When the extension is removed the file type is changed to 'application/x-executable' and it works as expected.
I confirm this on Gnome 2.30.2 on Ubuntu. It's not possible to launch executable .bin files (such as many binary installers). This should be fixed one way or another for good user experience.
[Bumping version number as per comment 3]
I added ".bin" to the name of an "application/x-executable" file, and it became "application/octet-stream". Comment 2 also reports a MIME type detection change. The MIME type change seems to be the reason for nautilus to ignore the executable flag. Is this perhaps a shared-mime-info bug?
Just as a side note: This problem still exists in Nautilus 3.8.2, at least on Fedora 19. As it is quite an annoying bug, please change the version to a current one and investigage further. Or if anyone can provide a workaround ...
I noticed that the *.bin glob pattern is associated with the MIME type application/octet-stream in the freedesktop.org database [1]. According to the spec [2], application/octet-stream is the most "generic" type. Also according to the spec [3], it's recommended to check the glob pattern first and only check for magic "if the glob matching fails or results in multiple conflicting mimetypes". This may explain why adding .bin to the filename results in "application/octet-stream" MIME type instead of the more specific "application/x-executable" MIME type which matches by magic. [1] http://cgit.freedesktop.org/xdg/shared-mime-info/tree/freedesktop.org.xml.in?id=8176c639e18ab5a66a691a3f78a4b9e1077b2c9d#n165 [2] http://cgit.freedesktop.org/xdg/shared-mime-info/tree/shared-mime-info-spec.xml?id=8176c639e18ab5a66a691a3f78a4b9e1077b2c9d#n865 [3] http://cgit.freedesktop.org/xdg/shared-mime-info/tree/shared-mime-info-spec.xml?id=8176c639e18ab5a66a691a3f78a4b9e1077b2c9d#n909
This bug is still valid and I can reproduce it in nautilus 3.24 and 3.25.90. I investigated further and it seems that this is caused by a gio function: g_content_type_can_be_executable This function returns TRUE for "application/x-executable" and "text/plain", but returns FALSE for every other type (including "application/octet-stream"). Not sure if application/octet-stream is excluded for oversight or if there is a reason not to include it. In any case, the source of the bug is not in nautilus, so I'm tentatively reassigning to gio.
Created attachment 357636 [details] [review] gcontenttype: aknowledge application/octet-stream can be executable A naïve fix.
This seems like the wrong fix to me. application/octet-stream is one of the most generic content types there is (it literally means ‘an arbitrary stream of bytes’), which does not necessarily mean it’s executable. It seems like the problem here is that your files are getting the wrong content type assigned to them ⇒ shared-mime-info bug. Please file a bug against shared-mime-info: https://bugs.freedesktop.org/enter_bug.cgi?product=shared-mime-info
(In reply to Philip Withnall from comment #10) > This seems like the wrong fix to me. application/octet-stream is one of the > most generic content types there is (it literally means ‘an arbitrary stream > of bytes’), which does not necessarily mean it’s executable. text/plain is rather generic as well, but maybe that's something to improve too. > It seems like the problem here is that your files are getting the wrong > content type assigned to them ⇒ shared-mime-info bug. Agreed. The *.bin extension is meaningless and should be ignored. > Please file a bug against shared-mime-info: > https://bugs.freedesktop.org/enter_bug.cgi?product=shared-mime-info Thanks for the link. I found that is is already reported: https://bugs.freedesktop.org/show_bug.cgi?id=101667
Review of attachment 357636 [details] [review]: The proper fix has been applied upstream.