After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 571377 - Not running executable file of MIME type application/x-extension-bin
Not running executable file of MIME type application/x-extension-bin
Status: RESOLVED NOTGNOME
Product: glib
Classification: Platform
Component: gio
2.52.x
Other All
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2009-02-12 01:22 UTC by JAlexoid
Modified: 2018-01-28 11:35 UTC
See Also:
GNOME target: ---
GNOME version: 2.29/2.30


Attachments
gcontenttype: aknowledge application/octet-stream can be executable (1.24 KB, patch)
2017-08-15 15:05 UTC, António Fernandes
rejected Details | Review

Description JAlexoid 2009-02-12 01:22:01 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:
Comment 1 Tim Fuchs 2009-06-17 00:28:46 UTC
For me this bug doesn't affect all files that contain a . but definitely all files that end in .bin
Comment 2 Sense Hofstede 2010-01-25 18:45:13 UTC
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.
Comment 3 ville.ranki 2010-08-04 14:36:41 UTC
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.
Comment 4 André Klapper 2011-08-11 12:40:08 UTC
[Bumping version number as per comment 3]
Comment 5 António Fernandes 2013-04-20 14:07:44 UTC
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?
Comment 6 Dominik Sandjaja 2013-11-03 09:53:21 UTC
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 ...
Comment 7 António Fernandes 2013-11-03 15:56:21 UTC
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
Comment 8 António Fernandes 2017-08-15 14:29:57 UTC
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.
Comment 9 António Fernandes 2017-08-15 15:05:45 UTC
Created attachment 357636 [details] [review]
gcontenttype: aknowledge application/octet-stream can be executable

A naïve fix.
Comment 10 Philip Withnall 2017-08-16 09:18:03 UTC
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
Comment 11 António Fernandes 2017-08-16 11:17:21 UTC
(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
Comment 12 António Fernandes 2018-01-28 11:35:30 UTC
Review of attachment 357636 [details] [review]:

The proper fix has been applied upstream.