Bug 26300 - [xdg-settings] [PATCH] Should use basenames in GNOME
Summary: [xdg-settings] [PATCH] Should use basenames in GNOME
Alias: None
Product: Portland
Classification: Unclassified
Component: xdg-utils (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Fathi Boudra
QA Contact:
Keywords: patch
Depends on:
Reported: 2010-01-28 09:33 UTC by Michael Terry
Modified: 2019-02-16 13:30 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:

Use basenames for GNOME (1.13 KB, patch)
2010-01-28 09:33 UTC, Michael Terry
Details | Splinter Review

Description Michael Terry 2010-01-28 09:33:27 UTC
Created attachment 32875 [details] [review]
Use basenames for GNOME

In GNOME, it's more appropriate to use basenames for the various browser gconf keys.

Notice the behavior of the "Preferred Applications" app.  It will set basenames, not full binary paths.  Thus, xdg-settings is in a bit of conflict with that app (the canonical method of changing preferred apps in GNOME).

Using full paths can also result in a bit of oddity when, say, using Chromium and it calls xdg-settings after having modified its own PATH to point at /usr/lib/chromium-browser first.  It ends up setting paths that avoid its wrapper script at /usr/bin.

I'm attaching a patch that fixes this for just GNOME.  I'm not sure if other DEs would appreciate the change, so I'm making it narrow.  (The patch was originally written for chromium's built-in version, so the diff src path probably isn't right, but the patch should apply.)
Comment 1 Lei Zhang 2010-01-28 14:39:02 UTC
For the patch itself, please make the change to xdg-settings.in as well.

The problem reported to Ubuntu mostly comes from the Chromium PPA being packaged funny:

1. As you mentioned, the package has /usr/lib/chromium-browser/chromium-browser and /usr/lib/chromium-browser, so there's confusion when the latter messes with PATH. Google Chrome doesn't have this problem, it's binary and wrapper scripts are /opt/google/chrome/chrome and /opt/google/chrome/google-chrome, respectively.

2. The chromium package's xml file in 
/usr/share/gnome-control-center/default-apps uses the basename, but it uses xdg-settings, which sets the full path. This mismatch confuses Gnome's Preferred Applications. Google Chrome works fine with Preferred Applications because it use the full path in the xml file.

If the Chromium PPA fixed those two issues, then there shouldn't be a problem with using the full path with Gnome. As far as I can tell, Gnome doesn't have a technical limitation that says basename only. It's only done by convention.

The reason we used the full path is so Chromium developers can run a self built copy of Chromium, set that as the default browser, and have the desktop environment know to use it as the default browser rather than the installed package. While this isn't a common use case for most users, it's very helpful for developers.
Comment 2 Lei Zhang 2010-01-28 15:14:03 UTC
Actually, it's not just developers who would want to set a non-packaged version of Chromium as the default browser. There also exist users who likes bleeding edge software and download chrome-linux.zip from Chromium's continuous build system.

Right now, one can just unzip chrome-linux.zip, run chrome-wrapper, and have the latest copy of Chromium and be able to set that as the default browser. This change will break that and make bleeding edge Chromium users set PATH to point to chrome-wrapper for it to work.
Comment 3 Michael Terry 2010-01-29 05:28:00 UTC
Lei Zhang, I agree it's not a requirement, but as you say it is a convention in GNOME to use basenames.  For example, all the other existing preferred apps use it.  So xdg-setting trying to set or get any of them would fail [1].

The current behavior was suited for chromium because the script comes from chromium, but it's not a good fit for the rest of GNOME.

The issue you bring up with versions in non-standard locations could be solved with PATH adjustments.

[1] xdg-setting check default-web-browser epiphany.desktop will check for '/usr/bin/epiphany' when it will find 'epiphany' and say 'no'.  And setting it will result in a 'Custom' preferred app instead of the existing option 'Epiphany'.
Comment 4 Michael Terry 2010-01-29 05:30:32 UTC
(Oh btw, downstream bug here: https://bugs.launchpad.net/bugs/513133)
Comment 5 GitLab Migration User 2019-02-16 13:30:07 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/xdg/xdg-utils/issues/37.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.