Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 01-10-2007, 06:04 PM   #1
LQ Newbie
Registered: Nov 2006
Distribution: Ubuntu 6.10 x86_64
Posts: 21

Rep: Reputation: 15
GNOME refuses to open certain file types without using the "open with" menu

Ok, so apparently some genious decided it would be a good idea for GNOME to automatically detect the type of file you are trying to open and refuse to open it if the mime type you chose for it doesn't match what it detects. For instance, say I was to associate .dat files with with the MIME type application/data. According to the official GNOME docs, you should create a file in /usr/share/mime/packages called Overrides.xml, and place the following in it:

<?xml version='1.0' encoding='utf-8'?>
<mime-info xmlns="">
  <mime-type type="application/data"><comment>raw data</comment><glob pattern="*.dat"/></mime-type>
Then you update the mime database by running "update-mime-database /usr/share/mime", and that should be all there is to it.

But, it's not nearly so simple (and it was already unneccesarily complicated since GNOME doesn't have any built in tools to manage MIME types). In addition to the manually configured MIME type, GNOME still performs a manual check of the contents of files to see if the match known MIME types, and if they don't it will refuse to open the file with an error similar to the following:

The filename "blah.dat" indicates that this file is of type "raw data". The contents of the file indicate that the file is of type "plain text document". If you open this file, the file might present a security risk to your system.

Do not open the file unless you created the file yourself, or received the file from a trusted source. To open the file, rename the file to the correct extension for "plain text document", then open the file normally. Alternatively, use the Open With menu to choose a specific application for the file.
Obviously having a mistaken identity of a dat file is going to be common, as it's a non-specific file type with varied usage. In this case, the file was mistaken for a plain text file, so GNOME refuses to open it. Well first of all, the file in question wasn't a plain text file to begin with, although it did contain plain text elements. Basically GNOME just plain got this file's identity wrong. In fact, opening it in a text editor and saving it would probably result in a corrupted file.

Now the question is, how do I get rid of this undesirable behavior and make GNOME open .dat files without a warning telling me it refuses to open the file because it detected the file was a different type than it's extension said it was even though it actually wasn't?
Old 01-10-2007, 06:52 PM   #2
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 677Reputation: 677Reputation: 677Reputation: 677Reputation: 677Reputation: 677
There may be more to do than edit that file unless this howto is obsolete:

Last edited by jschiwal; 01-11-2007 at 06:27 AM.
Old 01-10-2007, 07:15 PM   #3
LQ Newbie
Registered: Nov 2006
Distribution: Ubuntu 6.10 x86_64
Posts: 21

Original Poster
Rep: Reputation: 15
Eh, none of that is relevant to my current problem. One other thing I noticed... When the default folder sort is set to type, selecting a file with a MIME type detected differently than what it's extension says it should be causes nautilus to move the file's position inline with other files of that type. It would seem that GNOME doesn't use it's MIME type autodetection until a file becomes active for the sake of speed. I was curious about that, as I couldn't figure out why a few of my files were moving around randomly as soon as I right clicked them. Yet another reason to kill this idiotic file type autodetection.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting a default program to open certain file types in Gnome danran Debian 3 10-12-2005 11:07 PM
firefox / kde: "open with"-menu does not work properly pit1516 Linux - Software 2 07-21-2005 05:01 PM
add "open terminal here" to context menu nadroj Linux - Newbie 3 01-14-2005 11:52 PM
"open recent" menu enigma1 Linux - Software 2 08-10-2004 10:26 PM
Trouble adding GNOME "open with" application thito01 Red Hat 2 01-21-2004 12:19 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:48 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration