Bug 103363 - xdg-desktop-menu does not treat folders with spaces correctly
Summary: xdg-desktop-menu does not treat folders with spaces correctly
Status: NEW
Alias: None
Product: Portland
Classification: Unclassified
Component: xdg-utils (show other bugs)
Version: unspecified
Hardware: x86-64 (AMD64) Linux (All)
: medium trivial
Assignee: Portland Bugs
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-10-19 19:59 UTC by Antti Savolainen
Modified: 2017-11-09 13:34 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
contents of ~./.config/menus (33.00 KB, application/x-tar)
2017-10-19 19:59 UTC, Antti Savolainen
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Antti Savolainen 2017-10-19 19:59:51 UTC
Created attachment 134927 [details]
contents of ~./.config/menus

When editing wine program locations with menulibre the result often just breaks down with folders disappearing completely or some other weird glitch happening.

For example: If files in application-merged are removed so that they can be recreated, the files reappear after you move the .desktop files back to their folders with menulibre. If the folders contain spaces, it considers all spaces to be a separator for a sub-folder which can cause glitching (seen here https://i.imgur.com/JKOh4fF.png). Example file /menus/applications-merged/user-wine-wine-wine-Programs-League-of-Legends.menu in attachments

Steps to produce:
Install a program with spaces with wine
Delete the .menu file from applications-merged
Open menulibre and move the .desktop back to where it was

What happens
applications-merged should now contain a bugged file

I'm not sure how the folders disappearing works when you move the files around with menulibre without deleting anything from applications-merged.
Comment 1 Hans Petter Jansson 2017-11-05 20:40:43 UTC
Thanks for reporting this.

It looks like a bug in xdg-desktop-menu, which is a part of xdg-utils. It's a shell script, and from the looks of it it's not built to deal with filenames with spaces in them, e.g. it does this:

> for desktop_file in $directory_files; do ... done

...which breaks down when $directory_files expands to a list of names with spaces in them. There are ways to deal with this in shell scripts, but none of them are very pleasant (I suggest setting IFS='\n\t' and using arrays, but you have to make sure it works with bash, dash and maybe other shells).

As an a propos, I have correctly installed Wine menu files in ~/.config/menus/applications-merged/ with spaces in the directory names -- but I'm not sure what installed those.

I'm reassigning this bug to the appropriate product (which unfortunately is not that easy to locate).
Comment 2 Antti Savolainen 2017-11-09 13:34:35 UTC
I did a fresh install recently and noticed that after installing wine and a program with it that the menus folder doesn't have a symlink gnome-applications-merged or xfce-applications.menu at all. It only has applications-merged and a single .menu file for each of the .desktop files that you want to add to the menu. Possibly the reason why I was seeing duplicates in the whiskers menu.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.