xdg-update-menu overwrites the /usr/share/applications/defaults.list symlink with a file.

Bug #703106 reported by Joel Ebel
14
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Xdg-utils
Fix Released
Medium
xdg-utils (Ubuntu)
Fix Released
Undecided
Unassigned
Lucid
Fix Released
Undecided
Unassigned
Maverick
Fix Released
Undecided
Unassigned
Natty
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: xdg-utils

The desktop-file-utils package creates /usr/share/applications/defaults.list as a symlink to /etc/gnome/defaults.list. Unfortunately, the xdg-update-menu program, when called to install a .desktop file with new mime types, overwrites this symlink with a file. It does this by reading the defaults.list, writing to a temporary file, making edits, then copying it back. it doesn't notice if the defaults.list file is a symlink, and overwrites it with a file.

A common example of this is installing google chrome. it calls xdg-desktop-menu to install its desktop file, and the result is that /etc/gnome/defaults.list is no longer used.

I suggest that xdg-desktop-menu should canonicalize defaults.list before writing to it. I've attached a simple patch as an example. This patch will apply both to the latest package in natty, as well as to Lucid, where I'd really like this to be applied.

Revision history for this message
Joel Ebel (jbebel) wrote :
tags: added: patch
Revision history for this message
Marc Deslauriers (mdeslaur) wrote :

Thanks for reporting this issue, and attaching a patch.

Could you please file a bug for this in the upstream project's bug tracker: https://bugs.freedesktop.org/
(File it under "Portland")

Once the upstream bug has been filed, we can proceed to get this fixed in Ubuntu. Thanks!

Changed in xdg-utils (Ubuntu Lucid):
status: New → Confirmed
Changed in xdg-utils (Ubuntu Maverick):
status: New → Confirmed
Changed in xdg-utils (Ubuntu Natty):
status: New → Confirmed
Revision history for this message
Martin Pitt (pitti) wrote :

I created a git formatted patch against upstream master and forwarded it to upstream. Thanks!

Changed in xdg-utils:
importance: Undecided → Unknown
status: New → Unknown
Revision history for this message
Martin Pitt (pitti) wrote :

Fixed natty package uploaded, will be accepted after beta-1 freeze. Thanks!

Changed in xdg-utils (Ubuntu Natty):
status: Confirmed → Fix Committed
Changed in xdg-utils:
importance: Unknown → Medium
status: Unknown → Confirmed
Revision history for this message
Martin Pitt (pitti) wrote :

Patch was applied upstream now.

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

This bug was fixed in the package xdg-utils - 1.1.0~rc1-2ubuntu1

---------------
xdg-utils (1.1.0~rc1-2ubuntu1) natty; urgency=low

  [ Martin Pitt ]
  * Add xdg-update-menu-caonicalize-defaults.list.diff: Don't overwrite a
    /usr/share/applications/defaults.list symlink. Thanks to Joe Ebel for the
    original patch! (LP: #703106)

  [ Scott Ritchie ]
  * debian/patches/xdg-generic-use-mimetype.diff:
    - Update to fallback to generic on Gnome (LP: #602799)
 -- Martin Pitt <email address hidden> Wed, 30 Mar 2011 13:11:39 +0200

Changed in xdg-utils (Ubuntu Natty):
status: Fix Committed → Fix Released
Revision history for this message
Joel Ebel (jbebel) wrote :

My name is misspelled. :( No worries. Thanks for getting this in.

Changed in xdg-utils:
status: Confirmed → Fix Released
Revision history for this message
Colin Watson (cjwatson) wrote :

I've corrected your name in lp:ubuntu/xdg-utils, so future uploads from that branch will have a corrected changelog.

Revision history for this message
Colin Watson (cjwatson) wrote :

I'll backport this to lucid and maverick now. It'll require approval from another member of the ubuntu-sru team.

Revision history for this message
Clint Byrum (clint-fewbar) wrote :

APPROVED: version 1.0.2-6.1ubuntu3.1 should be accepted into lucid-proposed
APPROVED: version 1.0.2+cvs20100307-1ubuntu0.3 should be accepted into maverick-proposed

Revision history for this message
Martin Pitt (pitti) wrote : Please test proposed package

Accepted xdg-utils into maverick-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

Changed in xdg-utils (Ubuntu Maverick):
status: Confirmed → Fix Committed
tags: added: verification-needed
Revision history for this message
Martin Pitt (pitti) wrote :

Accepted xdg-utils into lucid-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

Changed in xdg-utils (Ubuntu Lucid):
status: Confirmed → Fix Committed
Revision history for this message
Pedro Villavicencio (pedro) wrote :

Is there any test case for this proposed package? May you please update the bug and add those? Thanks in advance.

Revision history for this message
Joel Ebel (jbebel) wrote :

Here's a simple test case.
1. Verify that /usr/share/applications/defaults.list is a symlink to /etc/gnome/defaults.list
2. Download the attached .desktop file, and run 'sudo xdg-desktop-menu install jbebel-test.desktop'.

If /usr/share/applications/defaults.list remains a symlink, and /etc/gnome/defaults.list contains "x-test/true=jbebel-test.desktop" then it's a pass.

If /etc/gnome/defaults.list did not get edited, and instead, now /usr/share/applications/defaults.list is a file that now contains "x-test/true=jbebel-test.desktop" then that's a fail.

Revision history for this message
Joel Ebel (jbebel) wrote :

I have verified that my test case fails with 1.0.2-6.1ubuntu3 and passes with 1.0.2-6.1ubuntu3.1 in Lucid.

Martin Pitt (pitti)
tags: added: verification-done-lucid
Revision history for this message
Jean-Baptiste Lallement (jibel) wrote :

SRU verification for Maverick:
I have reproduced the problem with xdg-utils 1.0.2+cvs20100307-1ubuntu0.2 in maverick-updates and have verified that the version of xdg-utils 1.0.2+cvs20100307-1ubuntu0.3 in -proposed fixes the issue.

Marking as verification-done

tags: added: verification-done
removed: verification-done-lucid verification-needed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package xdg-utils - 1.0.2-6.1ubuntu3.1

---------------
xdg-utils (1.0.2-6.1ubuntu3.1) lucid-proposed; urgency=low

  * debian/patches/xdg-update-menu-canonicalize-defaults.list.diff:
    - Don't overwrite a /usr/share/applications/defaults.list symlink.
      Thanks to Joel Ebel for the original patch! (LP: #703106)
 -- Colin Watson <email address hidden> Tue, 05 Apr 2011 17:27:26 +0100

Changed in xdg-utils (Ubuntu Lucid):
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package xdg-utils - 1.0.2+cvs20100307-1ubuntu0.3

---------------
xdg-utils (1.0.2+cvs20100307-1ubuntu0.3) maverick-proposed; urgency=low

  * debian/patches/xdg-update-menu-canonicalize-defaults.list.diff:
    - Don't overwrite a /usr/share/applications/defaults.list symlink.
      Thanks to Joel Ebel for the original patch! (LP: #703106)
 -- Colin Watson <email address hidden> Tue, 05 Apr 2011 17:33:07 +0100

Changed in xdg-utils (Ubuntu Maverick):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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