Last Comment Bug 373955 - [FIX]/etc/mailcap takes precedence on GNOME mime preferences
: [FIX]/etc/mailcap takes precedence on GNOME mime preferences
Status: RESOLVED FIXED
[need testcase]
: fixed1.8.1.4
Product: Core Graveyard
Classification: Graveyard
Component: File Handling (show other bugs)
: 1.8 Branch
: x86 Linux
: P2 normal (vote)
: mozilla1.9alpha4
Assigned To: Boris Zbarsky [:bz] (Out June 25-July 6)
: Hixie (not reading bugmail)
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-03-14 11:33 PDT by Mike Hommey [:glandium]
Modified: 2016-06-22 12:16 PDT (History)
7 users (show)
See Also:
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
This ought to do it (3.28 KB, patch)
2007-03-30 10:12 PDT, Boris Zbarsky [:bz] (Out June 25-July 6)
bzbarsky: review-
bzbarsky: superreview-
Details | Diff | Review
Better extension handling (7.02 KB, patch)
2007-03-30 19:20 PDT, Boris Zbarsky [:bz] (Out June 25-July 6)
cbiesinger: review+
cbiesinger: superreview+
dveditz: approval1.8.1.4+
Details | Diff | Review

Description Mike Hommey [:glandium] 2007-03-14 11:33:28 PDT
As per comment #44 in bug #273524, I'm filing a new bug about /etc/mailcap taking precedence on GNOME mime preferences. Here is the output running the following command:
NSPR_LOG_MODULES=HelperAppService:5 ./firefox http://developer.gnome.org/doc/whitepapers/nautilus/nautilus-internals.pdf
(the firefox used here is plain 2.0.0.2 taken from ftp.mozilla.org)

-1222022944[8a55eb0]: Found extension 'pdf' (filename is 'nautilus-internals.pdf', handling attachment: 0)
-1222022944[8a55eb0]: HelperAppService::DoContent: mime 'application/pdf', extension 'pdf'
-1222022944[8a55eb0]: Getting mimeinfo from type 'application/pdf' ext 'pdf'
-1222022944[8a55eb0]: Here we do a mimetype lookup for 'application/pdf'
-1222022944[8a55eb0]: -- LookUpExtensionsAndDescription for type 'application/pdf'
-1222022944[8a55eb0]: -- GetFileLocation.  Pref: 'helpers.private_mime_types_file'  EnvVar: '(null)'
-1222022944[8a55eb0]: -- GetExtensionsAndDescriptionFromMimetypesFile
-1222022944[8a55eb0]: Getting extensions and description from types file '~/.mime.types'
-1222022944[8a55eb0]: Using type 'application/pdf'
-1222022944[8a55eb0]: -- CreateInputStream
-1222022944[8a55eb0]: Current entry: 'type=application/x-java-jnlp-file desc="Java Web Start" exts="jnlp"'
-1222022944[8a55eb0]: -- ParseNetscapeMIMETypesEntry
-1222022944[8a55eb0]: -- GetFileLocation.  Pref: 'helpers.global_mime_types_file'  EnvVar: '(null)'
-1222022944[8a55eb0]: -- GetExtensionsAndDescriptionFromMimetypesFile
-1222022944[8a55eb0]: Getting extensions and description from types file '/etc/mime.types'
-1222022944[8a55eb0]: Using type 'application/pdf'
-1222022944[8a55eb0]: -- CreateInputStream
-1222022944[8a55eb0]: Current entry: 'application/activemessage'
-1222022944[8a55eb0]: -- ParseNormalMIMETypesEntry
-1222022944[8a55eb0]: Current entry: 'application/andrew-inset                  ez'
-1222022944[8a55eb0]: -- ParseNormalMIMETypesEntry
-1222022944[8a55eb0]: Current entry: 'application/applefile'
-1222022944[8a55eb0]: -- ParseNormalMIMETypesEntry
-1222022944[8a55eb0]: Current entry: 'application/atom                          atom'
-1222022944[8a55eb0]: -- ParseNormalMIMETypesEntry
-1222022944[8a55eb0]: Current entry: 'application/atomcat+xml                           atomcat'
-1222022944[8a55eb0]: -- ParseNormalMIMETypesEntry
-1222022944[8a55eb0]: Current entry: 'application/atomserv+xml                  atomsrv'
-1222022944[8a55eb0]: -- ParseNormalMIMETypesEntry
-1222022944[8a55eb0]: Current entry: 'application/atomicmail'
-1222022944[8a55eb0]: -- ParseNormalMIMETypesEntry
-1222022944[8a55eb0]: Current entry: 'application/batch-SMTP'
-1222022944[8a55eb0]: -- ParseNormalMIMETypesEntry
-1222022944[8a55eb0]: Current entry: 'application/beep+xml'
-1222022944[8a55eb0]: -- ParseNormalMIMETypesEntry
-1222022944[8a55eb0]: Current entry: 'application/cals-1840'
-1222022944[8a55eb0]: -- ParseNormalMIMETypesEntry
-1222022944[8a55eb0]: Current entry: 'application/cap                                   cap pcap'
-1222022944[8a55eb0]: -- ParseNormalMIMETypesEntry
-1222022944[8a55eb0]: Current entry: 'application/commonground'
-1222022944[8a55eb0]: -- ParseNormalMIMETypesEntry
-1222022944[8a55eb0]: Current entry: 'application/cu-seeme                              cu'
-1222022944[8a55eb0]: -- ParseNormalMIMETypesEntry
-1222022944[8a55eb0]: Current entry: 'application/cybercash'
-1222022944[8a55eb0]: -- ParseNormalMIMETypesEntry
-1222022944[8a55eb0]: Current entry: 'application/dca-rft'
-1222022944[8a55eb0]: -- ParseNormalMIMETypesEntry
-1222022944[8a55eb0]: Current entry: 'application/dec-dx'
-1222022944[8a55eb0]: -- ParseNormalMIMETypesEntry
-1222022944[8a55eb0]: Current entry: 'application/docbook+xml'
-1222022944[8a55eb0]: -- ParseNormalMIMETypesEntry
-1222022944[8a55eb0]: Current entry: 'application/dsptype                               tsp'
-1222022944[8a55eb0]: -- ParseNormalMIMETypesEntry
-1222022944[8a55eb0]: Current entry: 'application/dvcs'
-1222022944[8a55eb0]: -- ParseNormalMIMETypesEntry
-1222022944[8a55eb0]: Current entry: 'application/edi-consent'
-1222022944[8a55eb0]: -- ParseNormalMIMETypesEntry
-1222022944[8a55eb0]: Current entry: 'application/edi-x12'
-1222022944[8a55eb0]: -- ParseNormalMIMETypesEntry
-1222022944[8a55eb0]: Current entry: 'application/edifact'
-1222022944[8a55eb0]: -- ParseNormalMIMETypesEntry
-1222022944[8a55eb0]: Current entry: 'application/eshop'
-1222022944[8a55eb0]: -- ParseNormalMIMETypesEntry
-1222022944[8a55eb0]: Current entry: 'application/font-tdpfr'
-1222022944[8a55eb0]: -- ParseNormalMIMETypesEntry
-1222022944[8a55eb0]: Current entry: 'application/futuresplash                  spl'
-1222022944[8a55eb0]: -- ParseNormalMIMETypesEntry
-1222022944[8a55eb0]: Current entry: 'application/ghostview'
-1222022944[8a55eb0]: -- ParseNormalMIMETypesEntry
-1222022944[8a55eb0]: Current entry: 'application/hta                                   hta'
-1222022944[8a55eb0]: -- ParseNormalMIMETypesEntry
-1222022944[8a55eb0]: Current entry: 'application/http'
-1222022944[8a55eb0]: -- ParseNormalMIMETypesEntry
-1222022944[8a55eb0]: Current entry: 'application/hyperstudio'
-1222022944[8a55eb0]: -- ParseNormalMIMETypesEntry
-1222022944[8a55eb0]: Current entry: 'application/iges'
-1222022944[8a55eb0]: -- ParseNormalMIMETypesEntry
-1222022944[8a55eb0]: Current entry: 'application/index'
-1222022944[8a55eb0]: -- ParseNormalMIMETypesEntry
-1222022944[8a55eb0]: Current entry: 'application/index.cmd'
-1222022944[8a55eb0]: -- ParseNormalMIMETypesEntry
-1222022944[8a55eb0]: Current entry: 'application/index.obj'
-1222022944[8a55eb0]: -- ParseNormalMIMETypesEntry
-1222022944[8a55eb0]: Current entry: 'application/index.response'
-1222022944[8a55eb0]: -- ParseNormalMIMETypesEntry
-1222022944[8a55eb0]: Current entry: 'application/index.vnd'
-1222022944[8a55eb0]: -- ParseNormalMIMETypesEntry
-1222022944[8a55eb0]: Current entry: 'application/iotp'
-1222022944[8a55eb0]: -- ParseNormalMIMETypesEntry
-1222022944[8a55eb0]: Current entry: 'application/ipp'
-1222022944[8a55eb0]: -- ParseNormalMIMETypesEntry
-1222022944[8a55eb0]: Current entry: 'application/isup'
-1222022944[8a55eb0]: -- ParseNormalMIMETypesEntry
-1222022944[8a55eb0]: Current entry: 'application/java-archive                  jar'
-1222022944[8a55eb0]: -- ParseNormalMIMETypesEntry
-1222022944[8a55eb0]: Current entry: 'application/java-serialized-object                ser'
-1222022944[8a55eb0]: -- ParseNormalMIMETypesEntry
-1222022944[8a55eb0]: Current entry: 'application/java-vm                               class'
-1222022944[8a55eb0]: -- ParseNormalMIMETypesEntry
-1222022944[8a55eb0]: Current entry: 'application/mac-binhex40                  hqx'
-1222022944[8a55eb0]: -- ParseNormalMIMETypesEntry
-1222022944[8a55eb0]: Current entry: 'application/mac-compactpro                        cpt'
-1222022944[8a55eb0]: -- ParseNormalMIMETypesEntry
-1222022944[8a55eb0]: Current entry: 'application/macwriteii'
-1222022944[8a55eb0]: -- ParseNormalMIMETypesEntry
-1222022944[8a55eb0]: Current entry: 'application/marc'
-1222022944[8a55eb0]: -- ParseNormalMIMETypesEntry
-1222022944[8a55eb0]: Current entry: 'application/mathematica                           nb'
-1222022944[8a55eb0]: -- ParseNormalMIMETypesEntry
-1222022944[8a55eb0]: Current entry: 'application/mathematica-old'
-1222022944[8a55eb0]: -- ParseNormalMIMETypesEntry
-1222022944[8a55eb0]: Current entry: 'application/ms-tnef'
-1222022944[8a55eb0]: -- ParseNormalMIMETypesEntry
-1222022944[8a55eb0]: Current entry: 'application/msaccess                              mdb'
-1222022944[8a55eb0]: -- ParseNormalMIMETypesEntry
-1222022944[8a55eb0]: Current entry: 'application/msword                                doc dot'
-1222022944[8a55eb0]: -- ParseNormalMIMETypesEntry
-1222022944[8a55eb0]: Current entry: 'application/news-message-id'
-1222022944[8a55eb0]: -- ParseNormalMIMETypesEntry
-1222022944[8a55eb0]: Current entry: 'application/news-transmission'
-1222022944[8a55eb0]: -- ParseNormalMIMETypesEntry
-1222022944[8a55eb0]: Current entry: 'application/ocsp-request'
-1222022944[8a55eb0]: -- ParseNormalMIMETypesEntry
-1222022944[8a55eb0]: Current entry: 'application/ocsp-response'
-1222022944[8a55eb0]: -- ParseNormalMIMETypesEntry
-1222022944[8a55eb0]: Current entry: 'application/octet-stream                  bin'
-1222022944[8a55eb0]: -- ParseNormalMIMETypesEntry
-1222022944[8a55eb0]: Current entry: 'application/oda                                   oda'
-1222022944[8a55eb0]: -- ParseNormalMIMETypesEntry
-1222022944[8a55eb0]: Current entry: 'application/ogg                                   ogg'
-1222022944[8a55eb0]: -- ParseNormalMIMETypesEntry
-1222022944[8a55eb0]: Current entry: 'application/parityfec'
-1222022944[8a55eb0]: -- ParseNormalMIMETypesEntry
-1222022944[8a55eb0]: Current entry: 'application/pdf                                   pdf'
-1222022944[8a55eb0]: -- ParseNormalMIMETypesEntry
-1222022944[8a55eb0]: -- LookUpHandlerAndDescription for type 'application/pdf'
-1222022944[8a55eb0]: -- GetFileLocation.  Pref: 'helpers.private_mailcap_file'  EnvVar: 'PERSONAL_MAILCAP'
-1222022944[8a55eb0]: -- GetHandlerAndDescriptionFromMailcapFile
-1222022944[8a55eb0]: Getting handler and description from mailcap file '~/.mailcap'
-1222022944[8a55eb0]: Using type 'application/pdf'
-1222022944[8a55eb0]: Current entry: 'application/vnd.sun.xml.writer;/home/mh/.openoffice/1.1.1/soffice %s'
-1222022944[8a55eb0]: Current entry: 'application/vnd.sun.xml.writer.global;/home/mh/.openoffice/1.1.1/soffice %s'
-1222022944[8a55eb0]: Current entry: 'application/vnd.stardivision.writer;/home/mh/.openoffice/1.1.1/soffice %s'
-1222022944[8a55eb0]: Current entry: 'application/vnd.stardivision.writer-global;/home/mh/.openoffice/1.1.1/soffice %s'
-1222022944[8a55eb0]: Current entry: 'application/x-starwriter;/home/mh/.openoffice/1.1.1/soffice %s'
-1222022944[8a55eb0]: Current entry: 'application/vnd.sun.xml.writer.template;/home/mh/.openoffice/1.1.1/soffice %s'
-1222022944[8a55eb0]: Current entry: 'application/msword;/home/mh/.openoffice/1.1.1/soffice %s'
-1222022944[8a55eb0]: Current entry: 'application/vnd.sun.xml.calc;/home/mh/.openoffice/1.1.1/soffice %s'
-1222022944[8a55eb0]: Current entry: 'application/vnd.stardivision.calc;/home/mh/.openoffice/1.1.1/soffice %s'
-1222022944[8a55eb0]: Current entry: 'application/x-starcalc;/home/mh/.openoffice/1.1.1/soffice %s'
-1222022944[8a55eb0]: Current entry: 'application/vnd.sun.xml.calc.template;/home/mh/.openoffice/1.1.1/soffice %s'
-1222022944[8a55eb0]: Current entry: 'application/excel;/home/mh/.openoffice/1.1.1/soffice %s'
-1222022944[8a55eb0]: Current entry: 'application/msexcel;/home/mh/.openoffice/1.1.1/soffice %s'
-1222022944[8a55eb0]: Current entry: 'application/vnd.ms-excel;/home/mh/.openoffice/1.1.1/soffice %s'
-1222022944[8a55eb0]: Current entry: 'application/x-msexcel;/home/mh/.openoffice/1.1.1/soffice %s'
-1222022944[8a55eb0]: Current entry: 'application/vnd.sun.xml.impress;/home/mh/.openoffice/1.1.1/soffice %s'
-1222022944[8a55eb0]: Current entry: 'application/vnd.stardivision.impress;/home/mh/.openoffice/1.1.1/soffice %s'
-1222022944[8a55eb0]: Current entry: 'application/vnd.stardivision.impress-packed;/home/mh/.openoffice/1.1.1/soffice %s'
-1222022944[8a55eb0]: Current entry: 'application/x-starimpress;/home/mh/.openoffice/1.1.1/soffice %s'
-1222022944[8a55eb0]: Current entry: 'application/vnd.sun.xml.impress.template;/home/mh/.openoffice/1.1.1/soffice %s'
-1222022944[8a55eb0]: Current entry: 'application/powerpoint;/home/mh/.openoffice/1.1.1/soffice %s'
-1222022944[8a55eb0]: Current entry: 'application/mspowerpoint;/home/mh/.openoffice/1.1.1/soffice %s'
-1222022944[8a55eb0]: Current entry: 'application/vnd.ms-powerpoint;/home/mh/.openoffice/1.1.1/soffice %s'
-1222022944[8a55eb0]: Current entry: 'application/x-mspowerpoint;/home/mh/.openoffice/1.1.1/soffice %s'
-1222022944[8a55eb0]: Current entry: 'application/vnd.sun.xml.draw;/home/mh/.openoffice/1.1.1/soffice %s'
-1222022944[8a55eb0]: Current entry: 'application/vnd.stardivision.draw;/home/mh/.openoffice/1.1.1/soffice %s'
-1222022944[8a55eb0]: Current entry: 'application/x-stardraw;/home/mh/.openoffice/1.1.1/soffice %s'
-1222022944[8a55eb0]: Current entry: 'application/vnd.sun.xml.draw.template;/home/mh/.openoffice/1.1.1/soffice %s'
-1222022944[8a55eb0]: Current entry: 'application/vnd.sun.xml.math;/home/mh/.openoffice/1.1.1/soffice %s'
-1222022944[8a55eb0]: Current entry: 'application/vnd.stardivision.math;/home/mh/.openoffice/1.1.1/soffice %s'
-1222022944[8a55eb0]: Current entry: 'application/x-starmath;/home/mh/.openoffice/1.1.1/soffice %s'
-1222022944[8a55eb0]: Current entry: 'text/html; lynx -dump -force_html -display_charset=utf-8 -assume_charset=%{charset} %s; needsterminal; copiousoutput;'
-1222022944[8a55eb0]: Current entry: 'text/html; iconv -f %{charset} %s | lynx -stdin -dump -force_html -display_charset=utf-8 -assume_local_charset=utf-8; needsterminal; copiousoutput;'
-1222022944[8a55eb0]: Current entry: 'application/x-java-jnlp-file; /tmp/make-jpkg.slkFi29950/extract/jre1.5.0_06/bin/javaws %s'
-1222022944[8a55eb0]: -- LookUpHandlerAndDescription for type 'application/pdf'
-1222022944[8a55eb0]: -- GetFileLocation.  Pref: 'helpers.global_mailcap_file'  EnvVar: 'MAILCAP'
-1222022944[8a55eb0]: -- GetHandlerAndDescriptionFromMailcapFile
-1222022944[8a55eb0]: Getting handler and description from mailcap file '/etc/mailcap'
-1222022944[8a55eb0]: Using type 'application/pdf'
-1222022944[8a55eb0]: Current entry: 'text/html; /usr/bin/galeon '%s'; description=HTML Text; test=test -n "$DISPLAY"; nametemplate=%s.html'
-1222022944[8a55eb0]: Current entry: 'text/xml; /usr/bin/galeon '%s'; description=XML Text; test=test -n "$DISPLAY"; nametemplate=%s.xml'
-1222022944[8a55eb0]: Current entry: 'text/plain; less '%s'; needsterminal'
-1222022944[8a55eb0]: Current entry: 'image/svg+xml; inkscape '%s'; description="Scalable Vector Graphics"; test=test -n "$DISPLAY"; print=inkscape --print='|lp' '%s'; edit=inkscape '%s'; compose=inkscape '%s''
-1222022944[8a55eb0]: Current entry: 'image/svg; inkscape '%s'; description="Scalable Vector Graphics"; test=test -n "$DISPLAY"; print=inkscape --print='|lp' '%s'; edit=inkscape '%s';  compose=inkscape '%s''
-1222022944[8a55eb0]: Current entry: 'image/svg+xml; false; description="Scalable Vector Graphics"; test=test -z "$DISPLAY"; print=inkscape --print='|lp' '%s''
-1222022944[8a55eb0]: Current entry: 'image/svg; false; description="Scalable Vector Graphics"; test=test -z "$DISPLAY"; print=inkscape --print='|lp' '%s''
-1222022944[8a55eb0]: Current entry: 'video/mpeg; xine '%s'; description="MPEG Video"; test=test -n "$DISPLAY"'
-1222022944[8a55eb0]: Current entry: 'application/x-bittorrent; /usr/bin/btdownloadgui --responsefile '%s'; test=test -n "$DISPLAY"'
-1222022944[8a55eb0]: Current entry: 'application/x-bittorrent; /usr/bin/btdownloadcurses --responsefile '%s'; test=test -z "$DISPLAY"; needsterminal'
-1222022944[8a55eb0]: Current entry: 'application/pdf; evince '%s'; test=test -n "$DISPLAY" ; nametemplate=%s.pdf'
-1222022944[8a55eb0]: The real handler is: 'evince '%s''
-1222022944[8a55eb0]: -- UnescapeCommand
-1222022944[8a55eb0]: Command to escape: 'test -n "$DISPLAY" '
-1222022944[8a55eb0]: UnescapeCommand really needs some work -- it should actually do some unescaping
-1222022944[8a55eb0]: Escaped command: 'test -n "$DISPLAY" '
-1222022944[8a55eb0]: Running Test: test -n "$DISPLAY" 
-1222022944[8a55eb0]: Handler/Description results:  handler='evince', description='', mozillaFlags=''
-1222022944[8a55eb0]: -- nsOSHelperAppService::GetFileTokenForPath: 'evince'
-1222022944[8a55eb0]: OS gave back 0x9927420 - found: 1
-1222022944[8a55eb0]: Data source: Via type: retval 0x80040111
-1222022944[8a55eb0]: Data source: Via ext: retval 0x80040111
-1222022944[8a55eb0]: Extension 'pdf' matches mime info: 1
-1222022944[8a55eb0]: MIME Info Summary: Type 'application/pdf', Primary Ext 'pdf'
-1222022944[8a55eb0]: Type/Ext lookup found 0x9927420
Comment 1 Boris Zbarsky [:bz] (Out June 25-July 6) 2007-03-14 22:51:21 PDT
Ah, I see what's going on...

Basically, we don't get a _handler_ for application/pdf.  But we do fine extensions, since we call LookUpExtensionsAndDescription.  I'll see about fixing that when I get back.

Thank you for the log!
Comment 2 Boris Zbarsky [:bz] (Out June 25-July 6) 2007-03-30 10:12:55 PDT
Created attachment 260147 [details] [diff] [review]
This ought to do it
Comment 3 Boris Zbarsky [:bz] (Out June 25-July 6) 2007-03-30 10:14:38 PDT
Comment on attachment 260147 [details] [diff] [review]
This ought to do it

Mike, do you also want to try to get this in on the branch?
Comment 4 Mike Hommey [:glandium] 2007-03-30 14:54:00 PDT
+    // No useful data yet.  Assume that if the GNOME registry gives us anything
+    // it'll also give a sane list of extensions and a sane description so we
+    // don't have to look in mime.types files.  User mime.types files are rare
+    // anyway.

This is false: the gnome registry doesn't return extensions list in recent gnomevfs versions, while it returns descriptions.

(In reply to comment #3)
> (From update of attachment 260147 [details] [diff] [review])
> Mike, do you also want to try to get this in on the branch?

It'd be nice to have this on branch, yes.
Comment 5 Boris Zbarsky [:bz] (Out June 25-July 6) 2007-03-30 15:17:11 PDT
Hmm...  We call _gnome_vfs_mime_get_extensions_list with the given type.  Is that just a no-op now or something?

We use this code in a pretty serious way to map a type to valid extensions for the type, so we need to be sure not to break that.
Comment 6 Mike Hommey [:glandium] 2007-03-30 16:07:22 PDT
(In reply to comment #5)
> Hmm...  We call _gnome_vfs_mime_get_extensions_list with the given type.  Is
> that just a no-op now or something?

That's exactly that: it is a no-op nowadays. 

See comment #34 on bug #273524
Comment 7 Boris Zbarsky [:bz] (Out June 25-July 6) 2007-03-30 16:29:29 PDT
Comment on attachment 260147 [details] [diff] [review]
This ought to do it

Ugh.  So on the one hand GNOME does handler dispatch based on extension if you double-click a file, on the other hand it now doesn't allow apps to figure out what the right extension for a given type is.  Lovely.  Where do I go to file bugs on this inanity?  ;)

That basically means all this code needs to be redesigned; we need to get _most_ information from GNOME, but the extensions from elsewhere...
Comment 8 Boris Zbarsky [:bz] (Out June 25-July 6) 2007-03-30 16:31:09 PDT
I guess the patch in bug 273524 has something along the lines of what we need here...  I'll go ahead and steal that. ;)
Comment 9 Mike Hommey [:glandium] 2007-03-30 17:10:48 PDT
(In reply to comment #7)
> (From update of attachment 260147 [details] [diff] [review])
> Ugh.  So on the one hand GNOME does handler dispatch based on extension if you
> double-click a file, on the other hand it now doesn't allow apps to figure out
> what the right extension for a given type is.  Lovely.  Where do I go to file
> bugs on this inanity?  ;)

There is no bug there. GNOME doesn't care about extensions. It cares about mime types. And mime type is guessed by sniffing the file contents, not by its extensions. This is not windows.
Comment 10 Boris Zbarsky [:bz] (Out June 25-July 6) 2007-03-30 19:04:41 PDT
> There is no bug there. GNOME doesn't care about extensions.

Would that it were so!  I just tried this -- took a PDF file, renamed it to have a .gif extension, then opened Nautilus.  It showed the "generic GIF" GIF icon, and double-clicking on the file gave an error dialog about the extension and contents not matching (which is a step up from how I recall this working), but it did NOT open my file, nor did it give an option to do that (short of renaming the file)...  So yes, things are a little better than Windows.  But not enough better that we can save content with random extensions and have it Just Work.  :(
Comment 11 Boris Zbarsky [:bz] (Out June 25-July 6) 2007-03-30 19:20:28 PDT
Created attachment 260203 [details] [diff] [review]
Better extension handling

Mike, thank you for pointing out the problem and for the code that fixes it.
Comment 12 Mike Hommey [:glandium] 2007-03-31 00:05:23 PDT
(In reply to comment #10)
> > There is no bug there. GNOME doesn't care about extensions.
> 
> Would that it were so!  I just tried this -- took a PDF file, renamed it to
> have a .gif extension, then opened Nautilus.  It showed the "generic GIF" GIF
> icon, and double-clicking on the file gave an error dialog about the extension
> and contents not matching (which is a step up from how I recall this working),
> but it did NOT open my file, nor did it give an option to do that (short of
> renaming the file)...  So yes, things are a little better than Windows.  But
> not enough better that we can save content with random extensions and have it
> Just Work.  :(

I don't know what kind of ancient version of gnome you are using, but here, i can rename a pdf file with a gif extension and still see it as a pdf file, and launch evince when clicking it...
Comment 13 Mike Hommey [:glandium] 2007-03-31 00:06:21 PDT
(In reply to comment #11)
> Created an attachment (id=260203) [details]
> Better extension handling
> 
> Mike, thank you for pointing out the problem and for the code that fixes it.

I'll update the patch to bug #273524 when this lands
Comment 14 Boris Zbarsky [:bz] (Out June 25-July 6) 2007-03-31 07:37:08 PDT
I'm using Fedora Core 4.  As are many of our users.
Comment 15 Christian :Biesinger (don't email me, ping me on IRC) 2007-04-15 13:26:11 PDT
Comment on attachment 260203 [details] [diff] [review]
Better extension handling

sorry for the delay
Comment 16 Boris Zbarsky [:bz] (Out June 25-July 6) 2007-04-15 13:44:50 PDT
Checked in on trunk.
Comment 17 Boris Zbarsky [:bz] (Out June 25-July 6) 2007-04-15 13:47:44 PDT
Comment on attachment 260203 [details] [diff] [review]
Better extension handling

It might be worth fixing this on the 1.8 branch.  This fixes a pretty serious user-experience issue on modern Linux distros.  The patch is pretty safe; I would be surprised in the extreme if it causes regressions.

That said, it might make sense to land it for 1.8.1.5, not 1.8.1.4 given the timeframe here.  I just don't have a way to request approval for that release.  :(
Comment 18 Daniel Veditz [:dveditz] 2007-04-16 10:59:24 PDT
Comment on attachment 260203 [details] [diff] [review]
Better extension handling

approved for 1.8.1.4, a=dveditz for release-drivers
Comment 19 Boris Zbarsky [:bz] (Out June 25-July 6) 2007-04-16 11:56:32 PDT
Fixed on branch.
Comment 20 Tony Chung [:tchung] 2007-05-08 16:18:14 PDT
hi boris, mike... got a test case or repro scenario that QA can use to verify this fix?  Or is this a scenario that only devs can unit test and verify?   If so, please verify it against the latest 2.0.0.4 branch and mark as verified1.8.1.4.  Thanks
Comment 21 Boris Zbarsky [:bz] (Out June 25-July 6) 2007-05-08 19:24:18 PDT
Tony, this should work to reproduce this bug.  Note that the bug is Linux-only.

1) Make sure you have no plug-in that handles application/pdf.
2) Set up an application/pdf handler in the GNOME preferences.
3) Make sure the file /etc/mime.types exists and contains the line:

application/pdf                 pdf

4) Load an application/pdf file.

The resulting dialog should offer to use the handler you set up in step 2.  This bug was about it not doing so.

You can use some other type instead of PDF, of course.
Comment 22 Mike Hommey [:glandium] 2007-05-08 23:31:23 PDT
I would add a 3.5 step: Make sure the file /etc/mailcap contains an entry for application/pdf

Note You need to log in before you can comment on or make changes to this bug.