Bug 75530

Summary: xdg-open behaviour about %i contradicts desktop entry standard
Product: Portland Reporter: Olivier Diotte <vhann3000+freedesktop>
Component: xdg-utilsAssignee: Portland Bugs <portland-bugs>
Status: RESOLVED MOVED QA Contact:
Severity: normal    
Priority: medium CC: vhann3000+freedesktop
Version: 1.1.0 rc2   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 23105    
Attachments: Patch adding crude handling of %i and %c
Improved patch to handle multi-word Names like "Mozilla Firefox"

Description Olivier Diotte 2014-02-26 15:30:07 UTC
As described:
-https://bugs.gentoo.org/show_bug.cgi?id=489524
and
-https://bugs.kde.org/show_bug.cgi?id=326711

xdg-open causes an error unless there is "-icon" in front of %i in the .desktop files (contrary to spec, see https://bugs.kde.org/show_bug.cgi?id=326711#c1). Tested with 1.1.0-rc1 and 1.1.0-rc2.
Comment 1 Rex Dieter 2014-02-26 16:14:42 UTC
I cannot reproduce this error on kde (fedora 20) using xdg-utils-1.1.0-rc2

In short, 

xdg-open foo.pdf

runs okular without error for me.


What desktop environment are you using?
Comment 2 Rex Dieter 2014-02-26 16:24:48 UTC
I'm going to guess that the "generic" code path is hitting here, I think that's the only one that tries to parse .desktop files
Comment 3 Olivier Diotte 2014-02-26 16:34:11 UTC
(In reply to comment #1)
> I cannot reproduce this error on kde (fedora 20) using xdg-utils-1.1.0-rc2
> 
> In short, 
> 
> xdg-open foo.pdf
> 
> runs okular without error for me.
> 
> 
> What desktop environment are you using?

I am using wmii that I start manually with 'startx', so yes, generic.
Here is the result of 'env | grep -i XDG':
XDG_SESSION_COOKIE=[redacted since I have no idea if this is sensitive information]
XDG_CONFIG_DIRS=/etc/xdg
XDG_DATA_DIRS=/usr/local/share:/usr/share
Comment 4 Olivier Diotte 2014-10-13 05:26:14 UTC
Created attachment 107754 [details]
Patch adding crude handling of %i and %c

I think I have found the problem:

In the function search_desktop_file() of xdg-open, only %[fFuU] is handled. %i should be replaced by --icon <value of Icon key here>.

Attached is a patch that seems to work for that (and, as a bonus also replaces %c by the name, although it should technically replace it by the Name[<correct language>]).

I have tested with bash and bash in 'sh mode'. checkbashisms also doesn't complain.
Comment 5 Olivier Diotte 2015-03-10 01:20:52 UTC
Created attachment 114180 [details] [review]
Improved patch to handle multi-word Names like "Mozilla Firefox"

I just realized that my patch caused issues with Firefox. Better late than never I guess.
Comment 6 GitLab Migration User 2019-02-16 13:35:56 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/xdg/xdg-utils/issues/71.

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.