LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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.

Notices

Reply
 
Search this Thread
Old 01-10-2007, 05:04 PM   #1
Xzyx987X
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:

Code:
<?xml version='1.0' encoding='utf-8'?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
  <mime-type type="application/data"><comment>raw data</comment><glob pattern="*.dat"/></mime-type>
</mime-info>
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:

Quote:
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, 05:52 PM   #2
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
There may be more to do than edit that file unless this howto is obsolete:
http://developer.gnome.org/doc/white...ystemConfig.ps

Last edited by jschiwal; 01-11-2007 at 05:27 AM.
 
Old 01-10-2007, 06:15 PM   #3
Xzyx987X
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.
 
  


Reply


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 10:07 PM
firefox / kde: "open with"-menu does not work properly pit1516 Linux - Software 2 07-21-2005 04:01 PM
add "open terminal here" to context menu nadroj Linux - Newbie 3 01-14-2005 10:52 PM
"open recent" menu enigma1 Linux - Software 2 08-10-2004 09:26 PM
Trouble adding GNOME "open with" application thito01 Red Hat 2 01-21-2004 11:19 AM


All times are GMT -5. The time now is 09:59 PM.

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