[Python-modules-team] Bug#949738: fvwm-menu-desktop generates duplicate menu entries

Vincent Lefevre vincent at vinc17.net
Thu Jun 25 22:45:35 BST 2020


Control: reassign -1 python3-xdg 0.26-3
Control: retitle -1 python3-xdg: duplicate menu entries, e.g. via fvwm-menu-desktop
Control: affects -1 fvwm

Summary:
fvwm's fvwm-menu-desktop utility generates duplicate menu entries,
due to menu.getEntries() whose code comes from python3-xdg.

On 2020-06-25 12:49:04 -0600, Jaimos Skriletz wrote:
> On Thu, Jun 25, 2020 at 10:36 AM Vincent Lefevre <vincent at vinc17.net> wrote:
> >
> > On 2020-06-25 08:44:31 -0600, Jaimos Skriletz wrote:
> > > I am unable to reproduce this on my system. That being said,
> > > fvwm-menu-desktop generates the menu lists from python3-xdg using
> > > menu.getEntries(), so any duplicates are due to how python3-xdg
> > > generates the menu lists. I am able to create duplicate application
> > > entries by having a .desktop file with a different name in a secondary
> > > location (such as $HOME/.local/share/applications), but am unsure what
> > > could be causing the duplicate menu entries. So maybe you have some
> > > local files causing the duplicates in the XDG menu generation.
> >
> > The problem still occurs, and strace output shows that fvwm-menu-desktop
> > doesn't attempt to read any .desktop file. If you mean files with a
> > .desktop filename extension, then the same file is read 3 times, e.g.
> >
> > 1856042 stat("/usr/share/applications/exo-preferred-applications.desktop", {st_mode=S_IFREG|0644, st_size=9284, ...}) = 0
> > 1856042 stat("/usr/share/applications/exo-preferred-applications.desktop", {st_mode=S_IFREG|0644, st_size=9284, ...}) = 0
> > 1856042 openat(AT_FDCWD, "/usr/share/applications/exo-preferred-applications.desktop", O_RDONLY|O_CLOEXEC) = 3
> >
> > 1856042 stat("/usr/share/applications/exo-preferred-applications.desktop", {st_mode=S_IFREG|0644, st_size=9284, ...}) = 0
> > 1856042 stat("/usr/share/applications/exo-preferred-applications.desktop", {st_mode=S_IFREG|0644, st_size=9284, ...}) = 0
> > 1856042 openat(AT_FDCWD, "/usr/share/applications/exo-preferred-applications.desktop", O_RDONLY|O_CLOEXEC) = 3
> >
> > 1856042 stat("/usr/share/applications/exo-preferred-applications.desktop", {st_mode=S_IFREG|0644, st_size=9284, ...}) = 0
> > 1856042 stat("/usr/share/applications/exo-preferred-applications.desktop", {st_mode=S_IFREG|0644, st_size=9284, ...}) = 0
> > 1856042 openat(AT_FDCWD, "/usr/share/applications/exo-preferred-applications.desktop", O_RDONLY|O_CLOEXEC) = 3
> >
> 
> I wonder why it is reading the files multiple times. The list is all
> from python3-xdg, so the issue is with python3-xdg and not
> fvwm-menu-desktop. To see this you can add the following debug code
> (make a copy of /usr/bin/fvwm-menu-desktop) and add the following
> 'print' statement it line 734:
> 
>     print("#DEBUG",list(menu.getEntries()))
>     for entry in menu.getEntries():
>         if isinstance(entry, xdg.Menu.Menu):
> 
> (only add top line, other two are to give some context in the file)
> 
> That will print a list showing you what .desktop files were used
> (though for menus it will only print a menu object hash). It is that
> list from python3-xdg that is used to generate the menu, so you should
> see any duplicates in that list too. Since python3-xdg seems to be
> producing these duplicates, this bug should be forwarded to that
> package.

I confirm. Reassigning.

> I also only use a single menu entry too (same one
> /etc/xdg/menus/lxde-applications.menu though i'm in stable), but it
> uses other files (.directory files) to generate submenus, wonder if
> some of those are being read twice by python3-xdg similar to the
> .desktop files making duplicates causing the duplicate menu entries.

No, these files are read only once:

zira:~> grep 'openat.*\.directory' str.out

1856042 openat(AT_FDCWD, "/usr/share/desktop-directories/lxde-debian.directory", O_RDONLY|O_CLOEXEC) = 3
1856042 openat(AT_FDCWD, "/usr/share/desktop-directories/lxde-utility.directory", O_RDONLY|O_CLOEXEC) = 3
1856042 openat(AT_FDCWD, "/usr/share/desktop-directories/lxde-utility-accessibility.directory", O_RDONLY|O_CLOEXEC) = 3
1856042 openat(AT_FDCWD, "/usr/share/desktop-directories/lxde-development.directory", O_RDONLY|O_CLOEXEC) = 3
1856042 openat(AT_FDCWD, "/usr/share/desktop-directories/lxde-education.directory", O_RDONLY|O_CLOEXEC) = 3
1856042 openat(AT_FDCWD, "/usr/share/desktop-directories/lxde-game.directory", O_RDONLY|O_CLOEXEC) = 3
1856042 openat(AT_FDCWD, "/usr/share/desktop-directories/lxde-graphics.directory", O_RDONLY|O_CLOEXEC) = 3
1856042 openat(AT_FDCWD, "/usr/share/desktop-directories/lxde-network.directory", O_RDONLY|O_CLOEXEC) = 3
1856042 openat(AT_FDCWD, "/usr/share/desktop-directories/lxde-audio-video.directory", O_RDONLY|O_CLOEXEC) = 3
1856042 openat(AT_FDCWD, "/usr/share/desktop-directories/lxde-office.directory", O_RDONLY|O_CLOEXEC) = 3
1856042 openat(AT_FDCWD, "/usr/share/desktop-directories/lxde-system-tools.directory", O_RDONLY|O_CLOEXEC) = 3
1856042 openat(AT_FDCWD, "/usr/share/desktop-directories/lxde-other.directory", O_RDONLY|O_CLOEXEC) = 3
1856042 openat(AT_FDCWD, "/usr/share/desktop-directories/lxde-settings.directory", O_RDONLY|O_CLOEXEC) = 3
1856042 openat(AT_FDCWD, "/usr/share/desktop-directories/lxde-menu-applications.directory", O_RDONLY|O_CLOEXEC) = 3

Note: I have another machine, also with lxmenu-data. Same problem.
In both cases, the duplicate menu entries appear at least in the
"Preferences" menu:

DestroyMenu "Preferences"
AddToMenu "Preferences" "Preferences" Title
+ "Calc" Exec exec x-terminal-emulator -e calc
+ "NVIDIA X Server Settings (390xx legacy version)" Exec exec nvidia-settings
+ "TeXdoctk" Exec exec texdoctk
+ "Calc" Exec exec x-terminal-emulator -e calc
+ "NVIDIA X Server Settings (390xx legacy version)" Exec exec nvidia-settings
+ "TeXdoctk" Exec exec texdoctk

I also have a machine with gnome-menus instead of lxmenu-data, and
I also get duplicate menu entries there in the "Games" menu:

DestroyMenu "Games"
AddToMenu "Games" "Games" Title
+ "Nibbles" Exec exec gnome-nibbles
+ "Robots" Exec exec gnome-robots
+ "Nibbles" Exec exec gnome-nibbles
+ "Robots" Exec exec gnome-robots
+ "Board" Popup "Games/Board"
+ "AisleRiot Solitaire" Exec exec /usr/games/sol
+ "Tali" Exec exec tali
+ "AisleRiot Solitaire" Exec exec /usr/games/sol
+ "Tali" Exec exec tali
+ "Klotski" Exec exec gnome-klotski
+ "Mines" Exec exec gnome-mines
+ "Tetravex" Exec exec gnome-tetravex
+ "Klotski" Exec exec gnome-klotski
+ "Mines" Exec exec gnome-mines
+ "Tetravex" Exec exec gnome-tetravex
+ "Nibbles" Exec exec gnome-nibbles
+ "Robots" Exec exec gnome-robots
+ "Nibbles" Exec exec gnome-nibbles
+ "Robots" Exec exec gnome-robots
+ "Board" Popup "Games/Board"
+ "AisleRiot Solitaire" Exec exec /usr/games/sol
+ "Tali" Exec exec tali
+ "AisleRiot Solitaire" Exec exec /usr/games/sol
+ "Tali" Exec exec tali
+ "Klotski" Exec exec gnome-klotski
+ "Mines" Exec exec gnome-mines
+ "Tetravex" Exec exec gnome-tetravex
+ "Klotski" Exec exec gnome-klotski
+ "Mines" Exec exec gnome-mines
+ "Tetravex" Exec exec gnome-tetravex

-- 
Vincent Lefèvre <vincent at vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)



More information about the Python-modules-team mailing list