Bug 310674 - Desktop Entry Specification non compliance
Summary: Desktop Entry Specification non compliance
Status: RESOLVED FIXED
Alias: None
Product: frameworks-kcoreaddons
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 5.36.0
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: Michael Pyne
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-11-25 20:53 UTC by Andrei ILIE
Modified: 2017-08-12 22:46 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 5.38.0
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrei ILIE 2012-11-25 20:53:04 UTC
Just made a desktop entry file and discovered that spaces around the equals sign may prevent KDE from running the launcher:
    Type=Application (works)
    Type =Application (works)
    Type= Application (doesn't work)
    Type = Application (doesn't work)

The Desktop Entry Specification standard clearly states:
    "Space before and after the equals sign should be ignored; the = sign is the actual delimiter"

http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s02.html

Reproducible: Always
Comment 1 Christoph Feck 2017-08-03 19:35:28 UTC
Confirmed.

desktopfileparser.cpp still has this comment:
// TODO: should we also have to accept spaces around equals here?
Comment 2 Michael Pyne 2017-08-07 00:09:52 UTC
This also affects KF5::KConfig.  In fact given the wording of the bug I believe it is actually that Framework that is seeing the bug, KCoreAddons only handles desktop entry code for plugins.  Regardless I will submit a patch for both to Phabricator.
Comment 3 Michael Pyne 2017-08-09 03:42:08 UTC
Git commit 11ee92d92b1e9875a2707848324012fe881bf893 by Michael Pyne.
Committed on 09/08/2017 at 03:40.
Pushed by mpyne into branch 'master'.

kconfigini: Strip leading whitespace when reading entry values.

As per the Desktop Entry spec, we strip trailing whitespace from the key
when we split an entry into a key/value pair at the '='.  Now we also
strip leading whitespace from the resulting value like we should.

Differential Revision: https://phabricator.kde.org/D7169

M  +3    -3    autotests/kdesktopfiletest.cpp
M  +1    -0    src/core/kconfigini.cpp

https://commits.kde.org/kconfig/11ee92d92b1e9875a2707848324012fe881bf893
Comment 4 Michael Pyne 2017-08-12 22:46:05 UTC
Git commit 077ef6797eb63df9c875ee1bc719d677ef594360 by Michael Pyne.
Committed on 09/08/2017 at 03:46.
Pushed by mpyne into branch 'master'.

desktopfileparser: Fix non-compliant key/value parsing.

The Desktop Entry spec says we should ignore the spaces surrounding the
'=' delimiter in a Key=Value pair.  But we only do this sometimes (all
cases except the Type= entry which is handled specially).  This change
fixes Type entries to ignore whitespace as well.
FIXED-IN:5.38.0

Differential Revision: https://phabricator.kde.org/D7170

M  +2    -2    autotests/desktoptojsontest.cpp
M  +8    -3    src/lib/plugin/desktopfileparser.cpp

https://commits.kde.org/kcoreaddons/077ef6797eb63df9c875ee1bc719d677ef594360