Bug 69339

Summary: Unquoted file name in xdg-desktop-menu
Product: Portland Reporter: Martin von Gagern <Martin.vGagern>
Component: xdg-utilsAssignee: Portland Bugs <portland-bugs>
Status: RESOLVED DUPLICATE QA Contact:
Severity: normal    
Priority: medium    
Version: 1.1.0 rc1   
Hardware: All   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Martin von Gagern 2013-09-13 22:41:38 UTC
Line 895 of the xdg-desktop-menu script passed a file name unquoted to grep:

http://cgit.freedesktop.org/xdg/xdg-utils/tree/scripts/xdg-desktop-menu?id=2baf6ae56f9b622ca51aa79ff370676aaef93908#n895

if grep 'generated and managed by xdg-desktop-menu' $menu_file > /dev/null 2> /dev/null; then

On my system I have a file name containing the sequence ' - ', which caused grep to read from stdin, with obscure side effects. I believe that the command should be something like this:

grep 'ge…nu' -- "$menu_file"
Comment 1 Rex Dieter 2013-09-16 12:48:03 UTC
Since the "-" character is treated as special by
http://standards.freedesktop.org/menu-spec/menu-spec-latest.html

I'd highly recommend .desktop files use it only to specify vendor as referenced in the spec above.  Doing otherwise is just asking for trouble.

(While researching this more, there are many occurances of unquoted file access... fixing this potential problem fully will take some care).
Comment 2 Rex Dieter 2013-09-16 13:05:11 UTC
Fixed the immediate problem anyway, thanks,

http://cgit.freedesktop.org/xdg/xdg-utils/commit/?id=c96d7b00aca3da1b608fde5827d7fea8785b3cd3
Comment 3 Martin von Gagern 2013-09-16 14:02:27 UTC
The desktop files in question were installed by Wine. They had the format
"wine-Programs-WindowsVendor-WindowsAppName.desktop"
i.e. "wine-" as vendor prefix, and then the directory structure inside the start menu encoded using "-" as structure separator. The way I read the spec you mentioned, that only specifies the part up to the first "-", i.e. "wine-". I can see no restriction on the part after that, although I might well have missed that.

In any case, even though I only had two instances of " - " inside desktop files, I had a not more containing spaces, so xdg-desktop-menu should be able to cope with these. Handling that single location is therefore a step in the right direction. Thanks for fixing this.
Comment 4 Rodrigo Silva 2015-08-26 05:41:16 UTC

*** This bug has been marked as a duplicate of bug 66605 ***

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.