GNOME Bugzilla – Bug 123744
nautilus misdetecting file types as application/x-sh
Last modified: 2009-08-15 18:40:50 UTC
Nautilus is always detecting files with a #!/bin/bash, #!/bin/sh, and so on header line as being application/x-sh, even when the file suffix matches that of another file type. The panel run dialog does not suffer from this problem, so my assumption is Nautilus is special casing these files versus relying on the GNOME MIME system. In particular, this is biting the usage of AutoPackage files - they are technically shell scripts, but are shipped with a .package suffix, and can be opened/used with a separate GNOME front end, meaning they don't need to be bothered with an executable bit or the user selecting "run" instead of "view" (which doesn't work, since the files aren't really text, and GNOME defaults to gedit which can't handle this) - if Nautilus honoured the MIME settings, these packages would be able to install. Which would be uber cool. ^,^
what's the mimetype expected for your .package ? The mime detection is based on the free desktop shared-mime-info database so we need to reassign here with the details. Could you also join a .package file to the bug report ? The mime system need to be filled with a detectable pattern to detect the type.
mime-type should be: application/x-autopackage I won't attach a whole .package, they can be big - here's a link to the AutoPackage downloads page: http://autopackage.org/downloads.html You can install any of those by just downloading and running them once, that'll install the AutoPackage support code. Doing so also registers the MIME handlers for .package files. You can then observe how Nautilus will ignore the MIME type (handle it as a shell script) while gnome-open will work just fine (using gnome-vfs). The beginning of the script looks something like: #!/bin/bash # autopackage 0.6 # RootName @inkscape.org/inkscape:0.39cvs # SoftwareVersion 0.39cvs # InterfaceVersion # PackageVersion Perhaps checking for "#/bin/bash\n# autopackage " at the start of the file would work.
I've just looked on an example ( http://ftp.sunsite.dk/projects/autopackage/0.6/foobar-1.2.3.package) there is no mime registration done by the .package apparently. BTW if you want to get a mimetype supported it should be in the freedesktop database since nautilus use it. There is no such entry for the moment so I've reported the issue here: http://freedesktop.org/bugzilla/show_bug.cgi?id=1677 I'm closing this bug now since that's not a nautilus bug and the problem has been reported against shared-mime-info now. Feel free to reopen if you disagree
This is fixed in autopackage upstream anyway.