Some packages need a restart to appear in the menu

Bug #1967728 reported by Alkis Georgopoulos
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
mate-menus (Ubuntu)
New
Undecided
Unassigned

Bug Description

Steps to reproduce:

1) sudo apt install virtualbox
2) See that it doesn't appear in the menus
3) To make it appear, run any ONE of the following actions:
3a) Logout/login
3b) Or run: mate-panel --reset
3c) Or fake any menu file modification to cause a rescan:
sudo sed 's/a/a/' -i /usr/share/applications/mate-calc.desktop

This isn't a problem in the VirtualBox packaging. All other desktop environments correctly show its menu. It's a race condition that affects other packages as well; I'll try to explain it below.

When installing virtualbox, the following things happen:

1) The virtualbox package is unpacked and it provides a binary at /usr/share/virtualbox/VBox.sh.
2) The virtualbox-qt package is unpacked and it provides the menu at /usr/share/applications/virtualbox.desktop.
3) MATE scans for menu changes. It sees that virtualbox.desktop contains this line: TryExec=VirtualBox
It tries to locate a VirtualBox binary, and fails because it doesn't exist yet. It marks that menu as invalid.
4) A split second later the virtualbox-qt installation continues and the debhelper code that corresponds to `debian/virtualbox-qt.links` creates the `/usr/share/virtualbox/VBox.sh /usr/bin/VirtualBox` symlink and makes the VirtualBox binary available.

So the menu doesn't show up because it was marked as "missing executable" at step (3); it will show up if we ping the backend to scan the menus once more.
The solution would be to postpone the backend scanning for a second, when the symlink will exist.
Note that even though brisk-menu defines `BRISK_RELOAD_TIME 2000`, I think this isn't appropriate because it re-uses the wrong backend information from 2 seconds ago, when the symlink was missing.

Revision history for this message
Alkis Georgopoulos (alkisg) wrote :

The attached patch fixes the issue.

It replaces g_idle_add(...) that immediately calls the hooks,
with g_timeout_add_seconds (1, ...) that calls them a second later, when the symlink to the binary has been generated.

It worked in 100% of my tests.

no longer affects: mate-panel (Ubuntu)
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.