[SRU] Thunar open default not respecting mimetype

Bug #1382977 reported by Elfy
80
This bug affects 13 people
Affects Status Importance Assigned to Milestone
Thunar File Manager
Fix Released
Critical
thunar (Debian)
Fix Released
Unknown
thunar (Ubuntu)
Fix Released
Undecided
Unassigned
Utopic
Fix Released
Undecided
Unassigned
Vivid
Fix Released
Undecided
Unassigned

Bug Description

[SRU] Thunar open default not respecting mimetype

[Impact]
Thunar does not respect defaults per mimetype. This is an unintended consequence of glib >= 2.41. A patch has been distributed and verified in Debian and Vivid Vervet.

[Test Case]
From Thunar. try opening a file that has several mimetype handlers.

Expected:
Files open with whichever application is registered as its default handler.

Actual:
The file may be opened in an application other than the default.
 * Torrents open with Archive Manager instead of Transmission.
 * PDFs open in GIMP

[Regression Potential]
None. Fix verified in Debian and Vivid.

=== Original Report ===
A few files are defaulting to the wrong application. Up to date Utopic Xubuntu install, clean installed.

Currently

torrents are defaulting to open with Archive Manager

mp3's are currently defaulting to Easytag.

For mp3 /usr/share/applications/mimeinfo.cache originally was audio/x-mp3=parole.desktop

I have since installed Clementine, Soundconverter and Easytag in that order.

mimeinfo.cache now shows

audio/x-mp3=easytag.desktop;parole.desktop;soundconverter.desktop;clementine.desktop;

removing all except clementine makes no difference to what shows on the right click open with menu's

pdf's were defaulting to Gimp. I edited /usr/share/applications/mimeinfo.cache to remove gimp which worked for that

ProblemType: Bug
DistroRelease: Ubuntu 14.10
Package: desktop-file-utils 0.22-1ubuntu2
ProcVersionSignature: Ubuntu 3.16.0-23.30-generic 3.16.4
Uname: Linux 3.16.0-23-generic x86_64
NonfreeKernelModules: nvidia
ApportVersion: 2.14.7-0ubuntu7
Architecture: amd64
CurrentDesktop: XFCE
Date: Sun Oct 19 15:09:58 2014
InstallationDate: Installed on 2014-07-17 (93 days ago)
InstallationMedia: Xubuntu 14.10 "Utopic Unicorn" - Alpha amd64 (20140717)
SourcePackage: desktop-file-utils
UpgradeStatus: No upgrade log present (probably fresh install)

Related branches

Revision history for this message
In , Evangelos Foutras (foutrelis) wrote :

Beginning with glib >= 2.41, g_app_info_get_all_for_type() no longer puts the default application in front of the list. (See glib commit 6fd5a8c. [1])

Thunar seems to depend on the removed behavior to correctly pick the default application for the selected file(s), and thus needs to be adjusted to use g_app_info_get_default_for_type() instead.

I also found a Debian bug report about this with reproduction details. [2]

[1] https://git.gnome.org/browse/glib/commit/?id=6fd5a8c
[2] https://bugs.debian.org/763726

Revision history for this message
In , Evangelos Foutras (foutrelis) wrote :

Created attachment 5675
Fix "Open With" default app with glib >= 2.41

Here's a quick and dirty fix; maybe someone else can come up with a more elegant solution. :)

Revision history for this message
In , Evangelos Foutras (foutrelis) wrote :

Created attachment 5676
Fix "Open With" default app with glib >= 2.41

(I had to fix that "frond" typo. :3)

Revision history for this message
In , Guido Berhoerster (gber) wrote :

Created attachment 5690
ensure thunar_file_list_get_applications() has the default application as the first element of the returned list

Nice find. Since thunar_file_list_get_applications() and its only consumer thunar_launcher_update_idle() are the only places that expect g_app_info_get_all_for_type() to have the default application as the first element, I don't think it's necessary to expose something like thunar_g_app_info_get_all_for_type(). Attached is a slightly revised patch that inlines the list reordering into thunar_file_list_get_applications().

Revision history for this message
In , Evangelos Foutras (foutrelis) wrote :

(In reply to Guido Berhoerster from comment #3)
> Created attachment 5690 [details]
> ensure thunar_file_list_get_applications() has the default application as
> the first element of the returned list
>
> Nice find. Since thunar_file_list_get_applications() and its only consumer
> thunar_launcher_update_idle() are the only places that expect
> g_app_info_get_all_for_type() to have the default application as the first
> element, I don't think it's necessary to expose something like
> thunar_g_app_info_get_all_for_type(). Attached is a slightly revised patch
> that inlines the list reordering into thunar_file_list_get_applications().

I agree that this is the preferred way to fix this. I tested your patch and it works fine (as expected).

Please note that submitting a patch created using 'git format-patch' with proper commit message would ease the job of whoever commits this. It would also include proper credit for your work once it's applied. :)

Revision history for this message
Elfy (elfy) wrote :
Elfy (elfy)
affects: desktop-file-utils (Ubuntu) → thunar (Ubuntu)
no longer affects: desktop-file-utils
Revision history for this message
Elfy (elfy) wrote :
Changed in thunar:
importance: Unknown → Critical
status: Unknown → Confirmed
Changed in thunar (Debian):
status: Unknown → New
Elfy (elfy)
description: updated
Revision history for this message
Launchpad Janitor (janitor) wrote : Re: Default open with wrong

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in thunar (Ubuntu):
status: New → Confirmed
Elfy (elfy)
summary: - Default open with wrong
+ Thunar open default not respecting mimetype
Revision history for this message
Shuhao (shuhao) wrote : Re: Thunar open default not respecting mimetype

We should upgrade the importance to critical and get that patch out before release as it would be very annoying for users

Revision history for this message
In , Norbert Preining (preining) wrote :

Hi everyone,

I just tried the patch from the second attachment (from Guido) on Debian/sid, but it does not fix everything.

The selected application is now used, but changing the default application is still broken.

In particular, right clicking on an item I see
   Open with AAAAA
but when I right-click -> Properties and check the
   Open with
droplist, then there is a different value written.

It seems that another place needs fixing, or do I need to use *both* of the attached patches in this bug?

Thanks

Norbert

Revision history for this message
In , Guido Berhoerster (gber) wrote :

(In reply to Norbert Preining from comment #5)
> I just tried the patch from the second attachment (from Guido) on
> Debian/sid, but it does not fix everything.
>
> The selected application is now used, but changing the default application
> is still broken.
>
> In particular, right clicking on an item I see
> Open with AAAAA
> but when I right-click -> Properties and check the
> Open with
> droplist, then there is a different value written.
>
> It seems that another place needs fixing,

I cannot reproduce that here and I don't see how this is possible, the combobox in the properties dialog uses a ThunarChooserButton which calls g_app_info_get_default_for_type() to preselect the default application. So the preselected application in the properties dialog should always be correct and reflect what ~/.config/mimeapps.list contains. The context menu is what should be fixed by this patch (by calling the g_app_info_get_default_for_type() as the combobox does). Have you properly applied the patch before building thunar and are you sure you are actually running the rebuilt version?
If yes, then please provide some more detailed information on how to reproduce this. In particular, temporarily remove ~/.config/mimeapps.list, log out and back in, change the default association of some filetype and then report what the context menu shows, what the property dialog combobox has preselected and what the contents of ~/.config/mimeapps.list are and what your glib version is.

> or do I need to use *both* of the
> attached patches in this bug?

No, the second one is just a refactored version of the first one.

Revision history for this message
In , Norbert Preining (preining) wrote :

Ok, sorry for the noise.

I killed Thunar and restarted it, but that seems to not have sufficed.

After logging out of xfce and logging in again I now see the proper behaviour.

I will go ahead and prepare an NMU for Debian's thunar.

Thanks

Revision history for this message
In , Yves-Alexis Perez (corsac) wrote :

(In reply to Norbert Preining from comment #7)
> I will go ahead and prepare an NMU for Debian's thunar.

You don't really have to, you know. But it'd help to have it committed to master and stable branches first.

Revision history for this message
In , Eric Koegel (eric-koegel) wrote :

Created attachment 5715
Guido's patch

This is Guido's patch in a git am-able format.

Revision history for this message
In , Guido Berhoerster (gber) wrote :

(In reply to Eric Koegel from comment #9)
> Created attachment 5715 [details]
> Guido's patch
>
> This is Guido's patch in a git am-able format.

Thanks, but Evangelos should be credited for investigating and fixing this, I only did some minor refactoring.

Revision history for this message
In , Evangelos Foutras (foutrelis) wrote :

(In reply to Guido Berhoerster from comment #10)
> (In reply to Eric Koegel from comment #9)
> > Created attachment 5715 [details]
> > Guido's patch
> >
> > This is Guido's patch in a git am-able format.
>
> Thanks, but Evangelos should be credited for investigating and fixing this,
> I only did some minor refactoring.

Nah, your patch is the proper way to fix this so credit should go to you.

I'm fine with applying the latest patch as-is (the one attached by Eric).

Changed in thunar (Debian):
status: New → Fix Released
Revision history for this message
Michael MacEachern (maceach-b) wrote : Re: Thunar open default not respecting mimetype

When should I expect an update in Xubuntu that fixes this, so I can resume using my computer normally and continue my normal daily workflow for work?

Revision history for this message
Jackson Doak (noskcaj) wrote :

This will be fixed in the next 2-3 days for ubuntu vivid

Revision history for this message
In , Simon Steinbeiß (ochosi) wrote :

Pushed to master, thanks for the patch, testing and review.

Revision history for this message
Michael MacEachern (maceach-b) wrote :

So it's not possible to fix in the current 14.10 release, I have to use a BETA release which may carry it's own bugs of it's own? That's silly.

Revision history for this message
Sean Davis (bluesabre) wrote :

It will also be fixed in 14.10 as part of regular updates.

Revision history for this message
Michael MacEachern (maceach-b) wrote :

Right, but what's the ETA for 14.10?

Revision history for this message
Sean Davis (bluesabre) wrote :

This bug was fixed in the package thunar - 1.6.3-2ubuntu1

---------------
thunar (1.6.3-2ubuntu1) vivid; urgency=medium

  * Merge from Debian. Remaining changes:
    - debian/control: recommend udisks2 for mounting devices.
    - Use dh-autoreconf and xdt-autogen to update libtool.m4 for new ports.
    - Add git-xfdesktop-4.11.patch.
    - Add gtk3-bookmarks.patch, use new gtk3 bookmark location
    - Add git-save-keyboard-shortcuts.patch.
      + Keyboard shortcuts save when changed rather than when thunar is closed
    - Add menu-icon-tweaks.patch.
      + Don't use generic folder icons for open with default application
      + Add icons for open in new tab, new window
    - Add git-force-toolbr-icons.patch
      + Fix for "Home" and "Open Parent" icons going missing from toolbar
 -- Jackson Doak <email address hidden> Fri, 31 Oct 2014 07:27:27 +1100

thunar (1.6.3-2) unstable; urgency=medium

  [ Evgeni Golov ]
  * Correct Vcs-* URLs to point to anonscm.debian.org

  [ Jackson Doak ]
  * Bump standards-version to 3.9.6

  [ Yves-Alexis Perez ]
  * debian/control:
    - update long descriptions.
    - fix typo in thunar-dbg long description
  * debian/patches:
    - 02_fix-default-application-selection added, fix selection of default
      application for opening files, broken since glib 2.42. closes: #763726
 -- Yves-Alexis Perez <email address hidden> Thu, 30 Oct 2014 11:00:02 +0100

Changed in thunar (Ubuntu):
status: Confirmed → Fix Released
Changed in thunar:
status: Confirmed → Fix Released
Revision history for this message
Jackson Doak (noskcaj) wrote : Re: Thunar open default not respecting mimetype

I can't make the utopic branch for a week (real life stuff preventing internet), can someone else please make the upload?

Sean Davis (bluesabre)
summary: - Thunar open default not respecting mimetype
+ [SRU] Thunar open default not respecting mimetype
description: updated
Revision history for this message
Sean Davis (bluesabre) wrote :

Attaching debdiff for SRU to Utopic.

Changed in thunar (Ubuntu Utopic):
status: New → In Progress
Revision history for this message
Chris J Arges (arges) wrote : Please test proposed package

Hello Elfy, or anyone else affected,

Accepted thunar into utopic-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/thunar/1.6.3-1ubuntu6 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in thunar (Ubuntu Utopic):
status: In Progress → Fix Committed
tags: added: verification-needed
Revision history for this message
Jan-Philipp Litza (jplitza) wrote :

Thanks, version 1.6.3-1ubuntu6 fixed this bug for me.

tags: added: verification-done
removed: verification-needed
Revision history for this message
Der Müde Joe (wza-x) wrote :

Old behaviour:
.jpeg -> with Wine-IE
.java -> with Wine-notepad

After update:
Fixed.

.jpeg opens Ristretto.
Modifying default to gThumb. Now gThumb opens.

So fixed for me. Thx

Revision history for this message
Bernard Decock (decockbernard) wrote :

sudo apt-get install thunar/utopic-proposed

Problem not solved at first. (Can't change mime-type for jpg-images). After restarting the computer, all behaves well. Problem solved!

Changed mime-type for jpg (open with GIMP) : ok, opens with GIMP
Changed mime-type for jpg (open with Shotwell) : ok, opens with Shotwell
Changed mime-type for jpg (open with Ristreto) : ok, opens with Ristreto

Revision history for this message
Elfy (elfy) wrote :

Installed thunar 1.6.3-1ubuntu6 via proposed in utopic.

Works as expected following reboot.

Thanks

Revision history for this message
Shuhao (shuhao) wrote :

Any updates on pushing this into the regular utopic repository

Revision history for this message
Chris J Arges (arges) wrote : Update Released

The verification of the Stable Release Update for thunar has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package thunar - 1.6.3-1ubuntu6

---------------
thunar (1.6.3-1ubuntu6) utopic; urgency=medium

  * Add 02_fix-default-application-selection.patch. LP: #1382977
 -- Sean Davis <email address hidden> Mon, 03 Nov 2014 20:10:46 -0500

Changed in thunar (Ubuntu Utopic):
status: Fix Committed → Fix Released
Revision history for this message
Michael MacEachern (maceach-b) wrote :

It says fixed released, however I have no updates available and still have this bug. I am not seeing the fix.

Revision history for this message
Guido Zoellner (gzoellner) wrote :

Updated Thunar version 1.6.3-1ubuntu6 via utopic-updates fixed this bug for me on Ubuntu 14.10 without the need for a reboot. Thanks!

Revision history for this message
Michael MacEachern (maceach-b) wrote :
Revision history for this message
Michael MacEachern (maceach-b) wrote :

To the above because my text didn't post, this makes no sense. I see the update in terminal, but the GUI software updater doesn't?

Revision history for this message
Michael MacEachern (maceach-b) wrote :

I managed to force an update with sudo apt-get upgrade.

However, one small problem, the desktop icons right-click menu still show the wrong default, but DOES open up with the correct app (as it did originally). So there's still a small UI problem here.

Revision history for this message
Guido Zoellner (gzoellner) wrote :

Quickly as to the different update status of terminal and GUI updater: this might simply be a matter of Phased Updates, cf. e.g. http://askubuntu.com/questions/369722/update-manager-does-not-show-all-updates

Revision history for this message
Guido Zoellner (gzoellner) wrote :

And as to the other problem mentioned concerning a difference between the right-click menu and the application actually opening the file: I can NOT reproduce this on my machine. I have checked with several file types, including .png, and every time the correct default is showing in the right-click menu.

Revision history for this message
Guido Zoellner (gzoellner) wrote :

Ah, you were referring to desktop icons for the right-click menu. Sorry for any confusion caused, I was checking within Thunar itself, not with icons on the desktop.

Revision history for this message
Michael MacEachern (maceach-b) wrote :

Correct. Thunar itself is looking great, but I thought the desktop was also a part of Thunar too. Though the right-click menu on the desktop is showing the wrong open with app, it is however, opening the correct application on double-click. So right now, it's just more of a interface issue.

Revision history for this message
Dale (dj-kaza) wrote :

Any chance of getting this backported to Trusty? I have installed Thunar using the Trusty packages as there is functionality changes in 1.6.10 which cause it to be really unpleasant for me to use! As 16.04 has a newer version of libglib2.0-0 I have come across the issues that some files (for me seems to be only image files) will not follow the change of Default program. As neither Utopic or Vivid are supported any more the files from those releases are no longer available for download! Although the version does look like it should be the same in Utopic (1.6.3-1ubuntu5) I definitely have issues that sound related to this.

Revision history for this message
Dale (dj-kaza) wrote :

It appears 14.04.4 may be affect so please patch that version for all users, not just me with my odd usercase ;)

https://lists.ubuntu.com/archives/xubuntu-users/2016-April/009233.html

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.