Gnome/KDE applications.menu collision resolution breaks searching in applications-merged dir

Bug #297195 reported by Roderick B. Greening on 2008-11-12
32
This bug affects 3 people
Affects Status Importance Assigned to Milestone
kde4libs (Ubuntu)
High
Harald Sitter
Intrepid
High
Roderick B. Greening
Jaunty
High
Harald Sitter
kdebase-workspace (Ubuntu)
High
Roderick B. Greening
Intrepid
Undecided
Unassigned
Jaunty
High
Roderick B. Greening

Bug Description

Since Gnome uses the default applications.menu to house its menu structure, KDE is forced to use an alternate prefix like kde4-applications.menu, to prevent menu collisions.

To make this happen, a simple patch was introduced to tell KDE to use the new prefix. Unfortunately, the inadvertant side effect is that the prefix is inherited, and used to for DefaultMergeDirs, which means applications-merged never gets searched for new menu entries.

A proper fix needs to be introduced to allow KDE to use the DefaultMergeDirs directive correctly.

For now, if you manually insert a MergeDir directive into the kde4-applications.menu, pointing at applications-merged, things will work, but this is not the correct way as the spec is stil broken at this point.

The issue is caused by kbuildsycoca4 (the component responsible for parsing desktop files and creating the menu tree) using the variable which holds the default file name ($XDG_CONFIG_DIRS/menus/applications.menu) in order to compose the path for the applications-merged/ directory (which holds menu files from 3rd parties which are to be merged into the desktop's default structure or enhance the very same).
Since Ubuntu includes GNOME, KDE 3 and KDE 4 we have applications.menu (GNOME) kde-applications.menu (KDE 3) and kde4-applications.menu (KDE 4). Because kbuildsycoca4 uses the default file's basename to compose the merged directorie's with the current patch it will end up with kde4-applications-merged. This is for one pointless because this directory would only be used by someone who wants to manipulate KDE 4's menu structure only and for another breaking the spec implimentation:
Quoting about the applications-merged directory [1]:
    Note that a system that uses either gnome-applications.menu or kde-applications.menu depending on the desktop environment in
    use must still use applications-merged as the default merge directory in both cases.

KDE 4 doesn't do this because it composes kde4-applications-merged as default merge directory. One possible fix would be to alter the affected patch to hardcode applications-merged as directory name.
However, this approach would still not follow the specification completely. The very first section of [1] describes the most accurate way to handle multiple desktop installation.

Applied to KDE this means: revising the affected to patch to only change the installation path to kde4-applications.menu, but not the hardcoded name, and adding export $XDG_MENU_PREFIX="kde4-" to startkde (or possibly a custom start script) in order to make kbuildsycoca4 use this file instead of applications.menu.

In addition to this GNOME should use the very same approach and most importantly use gnome-applications.menu rather than applications.menu. This is a different bug though.

[1] http://standards.freedesktop.org/menu-spec/menu-spec-latest.html

description: updated
Changed in kde4libs:
importance: Undecided → High
status: New → Triaged
Changed in kdebase-workspace:
importance: Undecided → High
status: New → Triaged
Changed in kde4libs:
assignee: nobody → roderick-greening
Changed in kdebase-workspace:
assignee: nobody → roderick-greening

Adding two test patches below.

1) kubuntu_65_kde4_applications_menu.diff replaces 11_kde4_applications_menu.diff in kde4libs
2) kubuntu_54_use_xdg_menu_prefix.diff new in kdebase-workspace

The above implements XDG_MENU_PREFIX for kde4.

Harald Sitter (apachelogger) wrote :

Changes have to made in kdelibs exclusively, various standard KDE widgets rely on the menutree, so setting the env var in startkde would be insufficient.

Changed in kdebase-workspace:
status: Triaged → Invalid

Adding updated patch as per last comment.

Harald Sitter (apachelogger) wrote :

Changes have to made in kdelibs exclusively, various standard KDE widgets rely on the menutree, so setting the env var in startkde would be insufficient.

The following is true for Intrepid release (and earlier), Kubuntu (KDE4), default install

TEST CASE:
A) Not working
  1. install Kubuntu Intrepid (full release) - default install
  2. install wine (or other 3rd party package with adds menu entries to /etc/xdg/menus/applications-merged/)
  3. notice that the menu entries all show up in Lost & Found (even if manually running kbuildsycoca4 or after a reboot)
B) Working
  1. apply updated kde4libs (using attached patch)
  2. install wine (or other 3rd party package with adds menu entries to /etc/xdg/menus/applications-merged/)
  3. notice that the menu entries all show up in correct location (in this case a new menu folder Wine)
  4. notice that your other existing menu entries have not changed from default install

ANALYSIS

Under the XDG menu spec, the tag DefaultMergeDir is supposed to recurse the applications-merged directory looking for 3rd party menu items. However, since KDE4 and Gnome can both be installed, and Gnome uses the default applications.menu, without a prefix, KDE4 (kde4libs) was patched to hard code the kde4- prefix. This works for getting around the general menu collision, however, kbuildsycoca4 inherits this prefix and tries to look for kde4-applications-merged now, rather than applications-merged.

WORKAROUND(s):

The following are non-intrusive work-arounds that shows how to get it working.
  1. adding a symlink from kde4-applications-merged to applications-merged
  2. adding the MergeDir tag to kde4-applications.menu with the applications-merged directory
  3. patching kde4libs correctly (see attached)

The attached diff replaces debian patch 11_kde4_applications_menu.diff, which hard codes the the file kde4-applications.menu (from applications.menu), and causes the breakage. The reason this breaks is that the DefaultMergeDir is derived from kde4-applications.menu (becoming kde4-applications-merged) which does not exist. The updated patch instead, sets the kde4- prefix dynamically, if not set via the XDG_MENU_PREFIX env. Now DefaultMergeDir will derive from applications.menu, but we can still use the KDE4 specific kde4-applications.menu file.

Harald Sitter (apachelogger) wrote :

Fix committed to Debian SVN. We should grab the patch from there to decrease diff for next merge.

Changed in kdebase-workspace:
status: New → Invalid
Changed in kde4libs:
assignee: roderick-greening → apachelogger
status: Triaged → In Progress
Harald Sitter (apachelogger) wrote :
Changed in kde4libs:
assignee: nobody → roderick-greening
status: New → Triaged
importance: Undecided → High
Harald Sitter (apachelogger) wrote :

kde4libs (4:4.1.80-0ubuntu1) jaunty; urgency=low

  [ Jonathan Thomas ]
  * New upstream beta release
    - kdelibs5 conflicts/replaces kio-bookmarks since the KIO slave is in
      kdelibs now
    - Updated various .install files, several trailing whitespace fixes
    - Bump build-dep and runtime-dep versions
  * Add /usr/bin/preparetips to debian/not-installed

  [ Harald Sitter ]
  * Renamed 11_kde4_applications_menu.diff to
    kubuntu_54_use_xdg_menu_prefix.diff
    + Made the patch not break the menu spec implementation. The spec suggests
      to set the XDG_PREFIX_MENU var, however various KDE widgets rely on a
      working menutree, so we are forcing the appropriate variable within
      the parsing code to always use "kde4-" as prefix, unless the user
      overrides this with the mentioned environment variable (LP: 297195)

 -- Harald Sitter < <email address hidden>> Sun, 23 Nov 2008 14:35:19 +0100

Changed in kde4libs:
status: In Progress → Fix Released
Sergio Zanchetta (primes2h) wrote :

Thank you for reporting this bug to Ubuntu. Intrepid Ibex 8.10 reached EOL on 30 March 2010.
Please see this document for currently supported Ubuntu releases:
https://wiki.ubuntu.com/Releases

Please feel free to report any other bugs you may find.
Thank you.

Changed in kde4libs (Ubuntu Intrepid):
status: Triaged → Won't Fix
Sergio Zanchetta (primes2h) wrote :

I've just realized I made a mistake, Intrepid Ibex 8.10 "will reach" EOL on 30 "APRIL" 2010.

Sorry for this.

Anyway, I think that one month doesn't make any difference now.

Jonathan Thomas (echidnaman) wrote :

Agreed.

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

Duplicates of this bug

Other bug subscribers