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.)
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.
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.
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 .
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.
 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'.
(Oh btw, downstream bug here: https://bugs.launchpad.net/bugs/513133)