Bugs : mate-panel package : Ubuntu

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:
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.