Bug 385942 - Applications with URLs constructed with spaces can't be pinned and/or jump around
Summary: Applications with URLs constructed with spaces can't be pinned and/or jump ar...
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Task Manager and Icons-Only Task Manager (show other bugs)
Version: master
Platform: Other Linux
: NOR normal
Target Milestone: 1.0
Assignee: Eike Hein
URL:
Keywords:
: 385727 393665 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-10-19 09:56 UTC by Kai Uwe Broulik
Modified: 2020-07-12 04:50 UTC (History)
8 users (show)

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


Attachments
Screenshot showing two LO icons. (288.61 KB, image/png)
2018-02-05 13:12 UTC, Paul
Details
Taskmanager plasmashell crash (51.06 KB, text/plain)
2018-02-05 15:35 UTC, Nikolay Zlatev
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kai Uwe Broulik 2017-10-19 09:56:10 UTC
Task Manager generates applications urls by doing "applications:" + menuId, however if menuId contains spaces, this results in an invalid URL. The URL is usually accepted but in LauncherTasksModel::Private::requestAddLauncherToActivities an URL is constructed explicitly in StrictMode which rejects the spaces.

It should instead generate them percent-encoded, perhaps
QUrl url;
url.setScheme("applications");
url.setPath(menuId);

However, I tried that some time ago and it resulted in invalid URLs for some reason.
Comment 1 Nate Graham 2017-10-19 15:19:53 UTC
*** Bug 385727 has been marked as a duplicate of this bug. ***
Comment 2 Nate Graham 2017-12-13 20:23:21 UTC
Could this be what's behind the remaining scattered reports of https://bugs.kde.org/show_bug.cgi?id=385594?
Comment 3 Nikolay Zlatev 2017-12-14 14:57:37 UTC
Comming from https://bugs.kde.org/show_bug.cgi?id=385594

Application with space in the name can't be pinned at all.
No error message, but if I choose "Add to Panel(Widget)" from menu, application attach to panel but system receive log message "14 16:31:04 plasmashell[10610]: Empty filename passed to function"


_NET_WM_ICON_NAME(UTF8_STRING) =
XdndAware(ATOM) = BITMAP
WM_NAME(STRING) = "Data Extractor"
_NET_WM_NAME(UTF8_STRING) = "Data Extractor"
_KDE_NET_WM_USER_CREATION_TIME(CARDINAL) = 25882978
_MOTIF_WM_HINTS(_MOTIF_WM_HINTS) = 0x3, 0x3e, 0x7e, 0x0, 0x0
_NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_NORMAL
_XEMBED_INFO(_XEMBED_INFO) = 0x0, 0x1
WM_CLIENT_LEADER(WINDOW): window id # 0x4e00007
WM_HINTS(WM_HINTS):
                Client accepts input or input focus: True
                Initial state is Normal State.
_NET_WM_PID(CARDINAL) = 25527
_NET_WM_SYNC_REQUEST_COUNTER(CARDINAL) = 81788934
WM_CLASS(STRING) = "DataExtractor", "DataExtractor"
WM_PROTOCOLS(ATOM): protocols  WM_DELETE_WINDOW, WM_TAKE_FOCUS, _NET_WM_PING, _NET_WM_SYNC_REQUEST
WM_NORMAL_HINTS(WM_SIZE_HINTS):
                user specified location: 4, 29
                user specified size: 1272 by 687
                program specified minimum size: 1010 by 640
                window gravity: Static

On App start 

дек 14 16:39:27 telamon kactivitymanagerd[10633]: Creating the cache for:  "applications:Data Extractor.desktop"
дек 14 16:39:27 telamon kactivitymanagerd[10633]: Already in database?  true
дек 14 16:39:27 telamon kactivitymanagerd[10633]:       First update :  QDateTime(2017-06-23 19:17:50.000 EEST Qt::TimeSpec(LocalTime))
дек 14 16:39:27 telamon kactivitymanagerd[10633]:        Last update :  QDateTime(2017-12-14 16:39:06.000 EET Qt::TimeSpec(LocalTime))
дек 14 16:39:27 telamon kactivitymanagerd[10633]: After the adjustment
дек 14 16:39:27 telamon kactivitymanagerd[10633]:      Current score :  16.7956
дек 14 16:39:27 telamon kactivitymanagerd[10633]:       First update :  QDateTime(2017-06-23 19:17:50.000 EEST Qt::TimeSpec(LocalTime))
дек 14 16:39:27 telamon kactivitymanagerd[10633]:        Last update :  QDateTime(2017-12-14 16:39:06.000 EET Qt::TimeSpec(LocalTime))
дек 14 16:39:27 telamon kactivitymanagerd[10633]: Interval length is  0
дек 14 16:39:27 telamon kactivitymanagerd[10633]:          New score :  17.7956
дек 14 16:39:27 telamon kactivitymanagerd[10633]: ResourceScoreUpdated: "c4440aa5-23a1-46d9-9837-305110763943" "org.kde.plasma.kicker" "applications:Data Extractor.desktop"
дек 14 16:39:27 telamon plasmashell[10610]: KActivitiesStats( 0x55d230a0fe50 ) ResultModelPrivate::onResultScoreUpdated  result added: "applications:Data Extractor.desktop" score: 17.7956 last: 1513262365 first: 1498234670

After renaming desktop file
mv "Data Extractor.desktop" DataExtractor.desktop
everything work at it should.
Comment 4 Nate Graham 2018-02-05 01:42:48 UTC
Can anyone reproduce with Plasma 5.11.5 or 5.12? I can't.
Comment 5 Paul 2018-02-05 13:12:49 UTC
Created attachment 110351 [details]
Screenshot showing two LO icons.

@Nate

Afraid it's still happening with the icon for Libre office.  Screenshot shows the correctly positioned LO icon (pointed to my mouse cursor) and the second LO icon at far right.

Unpinning and re-adding the LO icon (as had been suggested in one of the previous related bug reports) does not effect a "cure".
Comment 6 Eike Hein 2018-02-05 13:14:33 UTC
Could you try this patch? It fixes a relevant bug. https://phabricator.kde.org/D10253
Comment 7 Nikolay Zlatev 2018-02-05 13:47:37 UTC
If .desktop file contains 'space' in the file name, launcher can't be pinned at all (correctly placed and drawed in task manager)

Tested with Arch x86_64
Plasma 5.11.5
Framework 5.42.0
With and without D10253.diff applied

Application start without D10253
фев 05 15:22:03 telamon kactivitymanagerd[1172]: Creating the cache for:  "applications:Data Extractor.desktop"
фев 05 15:22:03 telamon kactivitymanagerd[1172]: Already in database?  true
фев 05 15:22:03 telamon kactivitymanagerd[1172]:       First update :  QDateTime(2017-06-23 19:17:30.000 EEST Qt::TimeSpec(LocalTime))
фев 05 15:22:03 telamon kactivitymanagerd[1172]:        Last update :  QDateTime(2018-02-05 15:20:41.000 EET Qt::TimeSpec(LocalTime))
фев 05 15:22:03 telamon kactivitymanagerd[1172]: After the adjustment
фев 05 15:22:03 telamon kactivitymanagerd[1172]:      Current score :  2
фев 05 15:22:03 telamon kactivitymanagerd[1172]:       First update :  QDateTime(2017-06-23 19:17:30.000 EEST Qt::TimeSpec(LocalTime))
фев 05 15:22:03 telamon kactivitymanagerd[1172]:        Last update :  QDateTime(2018-02-05 15:20:41.000 EET Qt::TimeSpec(LocalTime))
фев 05 15:22:03 telamon kactivitymanagerd[1172]: Interval length is  0
фев 05 15:22:03 telamon kactivitymanagerd[1172]:          New score :  3
фев 05 15:22:03 telamon kactivitymanagerd[1172]: ResourceScoreUpdated: "c4440aa5-23a1-46d9-9837-305110763943" "org.kde.krunner" "applications:Data Extractor.desktop"


Application start with D10253
фев 05 15:32:03 telamon kactivitymanagerd[1172]: Creating the cache for:  "applications:Data Extractor.desktop"
фев 05 15:32:03 telamon kactivitymanagerd[1172]: Already in database?  true
фев 05 15:32:03 telamon kactivitymanagerd[1172]:       First update :  QDateTime(2017-06-23 19:17:50.000 EEST Qt::TimeSpec(LocalTime))
фев 05 15:32:03 telamon kactivitymanagerd[1172]:        Last update :  QDateTime(2017-12-14 16:49:25.000 EET Qt::TimeSpec(LocalTime))
фев 05 15:32:03 telamon kactivitymanagerd[1172]: After the adjustment
фев 05 15:32:03 telamon kactivitymanagerd[1172]:      Current score :  3.5872
фев 05 15:32:03 telamon kactivitymanagerd[1172]:       First update :  QDateTime(2017-06-23 19:17:50.000 EEST Qt::TimeSpec(LocalTime))
фев 05 15:32:03 telamon kactivitymanagerd[1172]:        Last update :  QDateTime(2017-12-14 16:49:25.000 EET Qt::TimeSpec(LocalTime))
фев 05 15:32:03 telamon kactivitymanagerd[1172]: Interval length is  0
фев 05 15:32:03 telamon kactivitymanagerd[1172]:          New score :  4.5872
фев 05 15:32:03 telamon kactivitymanagerd[1172]: ResourceScoreUpdated: "c4440aa5-23a1-46d9-9837-305110763943" "org.kde.plasma.kicker" "applications:Data Extractor.desktop"
фев 05 15:32:03 telamon plasmashell[10808]: KActivitiesStats( 0x55f64a337b40 ) ResultModelPrivate::onResultScoreUpdated  result added: "applications:Data Extractor.desktop" score: 4.5872 last: 1517837521 first: 1498234670
Comment 8 Eike Hein 2018-02-05 14:00:47 UTC
Thanks Nikolay, I'll look into soon.
Comment 9 Eike Hein 2018-02-05 15:13:54 UTC
Can confirm, pinning with spaces doesn't work.
Comment 10 Nikolay Zlatev 2018-02-05 15:24:25 UTC
Problem with libreoffice:

All launchers execute same file (/usr/bin/libreoffice) with parameter (--calc for example).

Wrapping executable to libreoffice_calc improves things.
Also if --nologo (disable splash screen and no dynamic change of window classname) is applied, launcher can't be placed/combined correctly in taskmanager at all.
Comment 11 Paul 2018-02-05 15:26:18 UTC
(In reply to Eike Hein from comment #6)
> Could you try this patch? It fixes a relevant bug.
> https://phabricator.kde.org/D10253

Sorry, unable to apply patches other than simple manual edits to qml files etc.

Just for information, and perhaps irrelevant, the desktop file for Libre Office Writer does not contain spaces in it's name.

The following snippet is from ~/.config/plasma-org.kde.plasma.desktop-appletsrc

file:///usr/share/applications/org.kde.kate.desktop,applications:writer.desktop,file:///home/paul/.local/share/applications/org.kde.digikam.desktop

the actual desktop file (writer.desktop) appears to be located in two locations:
/usr/share/applications
/usr/lib64/libreoffice/share/xdg
Comment 12 Nikolay Zlatev 2018-02-05 15:35:20 UTC
Created attachment 110352 [details]
Taskmanager plasmashell crash

If we have pinned launcher with 'Exec' parameter that not exists, on start whole plasmashell crash.
Comment 13 Eike Hein 2018-02-08 09:41:58 UTC
Patch for the spaces issue: https://phabricator.kde.org/D10383
Comment 14 Nikolay Zlatev 2018-02-08 10:20:01 UTC
Can confirm, patch D10383 resolve spaces issue.
Plasma 5.11.5
Comment 15 Eike Hein 2018-02-08 13:48:04 UTC
> If we have pinned launcher with 'Exec' parameter that not exists, on start whole plasmashell crash.

I can't reproduce that crash (I get an error dialog "Unknown application folder"). The backtrace also looks unrelated ...
Comment 16 Nikolay Zlatev 2018-02-08 13:56:09 UTC
(In reply to Eike Hein from comment #15)
> > If we have pinned launcher with 'Exec' parameter that not exists, on start whole plasmashell crash.
> 
> I can't reproduce that crash (I get an error dialog "Unknown application
> folder"). The backtrace also looks unrelated ...

0. journalctl -f
1. Pin app
2. Edit .desktop file add random symbol to executable
3. Start application (alert dialog appears Could not find the program etc.)
4. Click on OK button and wait
Comment 17 Nikolay Zlatev 2018-02-08 14:11:33 UTC
(In reply to Eike Hein from comment #15)
> > If we have pinned launcher with 'Exec' parameter that not exists, on start whole plasmashell crash.
> 
> I can't reproduce that crash (I get an error dialog "Unknown application
> folder"). The backtrace also looks unrelated ...

фев 08 16:10:12 telamon kdeinit5[20168]: Service  "org.kde.StatusNotifierHost-28341" unregistered
фев 08 16:10:12 telamon systemd[1]: Started Process Core Dump (PID 28716/UID 0).
фев 08 16:10:12 telamon kwin_x11[20197]: QXcbConnection: XCB error: 3 (BadWindow), sequence: 45669, resource id: 33554442, major code: 15 (QueryTree), minor code: 0
фев 08 16:10:12 telamon kwin_x11[20197]: QXcbConnection: XCB error: 3 (BadWindow), sequence: 45723, resource id: 33554454, major code: 15 (QueryTree), minor code: 0
фев 08 16:10:12 telamon kwin_x11[20197]: QXcbConnection: XCB error: 3 (BadWindow), sequence: 45776, resource id: 33554466, major code: 15 (QueryTree), minor code: 0
фев 08 16:10:12 telamon plasmashell[28714]: kf5.karchive: bzDecompress returned -5
фев 08 16:10:12 telamon plasmashell[28714]: Warning: all files used by qml by the plasmoid should be in ui/. The file in the path "file:///usr/share/plasma/plasmoids/org.kde.desktopcontainment/contents/code/LayoutManager.js" was expected at QUrl("file:///usr/share/plasma/plasmoids/org.kde.desktopcontainment/contents/ui/LayoutManager.js")
фев 08 16:10:12 telamon plasmashell[28714]: Warning: all files used by qml by the plasmoid should be in ui/. The file in the path "file:///usr/share/plasma/plasmoids/org.kde.desktopcontainment/contents/code/FolderTools.js" was expected at QUrl("file:///usr/share/plasma/plasmoids/org.kde.desktopcontainment/contents/ui/FolderTools.js")
Comment 18 Nikolay Zlatev 2018-02-08 14:15:12 UTC
> фев 08 16:10:12 telamon kdeinit5[20168]: Service 
> "org.kde.StatusNotifierHost-28341" unregistered
> фев 08 16:10:12 telamon systemd[1]: Started Process Core Dump (PID 28716/UID
> 0).
> фев 08 16:10:12 telamon plasmashell[28714]: kf5.karchive: bzDecompress
> returned -5
> фев 08 16:10:12 telamon plasmashell[28714]: Warning: all files used by qml
> by the plasmoid should be in ui/. The file in the path
> "file:///usr/share/plasma/plasmoids/org.kde.desktopcontainment/contents/code/
> LayoutManager.js" was expected at
> QUrl("file:///usr/share/plasma/plasmoids/org.kde.desktopcontainment/contents/
> ui/LayoutManager.js")
> фев 08 16:10:12 telamon plasmashell[28714]: Warning: all files used by qml
> by the plasmoid should be in ui/. The file in the path
> "file:///usr/share/plasma/plasmoids/org.kde.desktopcontainment/contents/code/
> FolderTools.js" was expected at
> QUrl("file:///usr/share/plasma/plasmoids/org.kde.desktopcontainment/contents/
> ui/FolderTools.js")

This happen only if .desktop file is pinned.
Comment 19 Eike Hein 2018-02-09 12:58:10 UTC
Can reproduce now, thanks! I tried with an empty Exec= before.
Comment 20 Eike Hein 2018-02-09 13:56:28 UTC
Patch for the Exec= issue: https://phabricator.kde.org/D10405
Comment 21 Nikolay Zlatev 2018-02-09 14:47:40 UTC
(In reply to Eike Hein from comment #20)
> Patch for the Exec= issue: https://phabricator.kde.org/D10405

Tested everything works fine.
Comment 22 Eike Hein 2018-02-15 18:48:02 UTC
Git commit e3a80661c9cd83677d44f4f6999d24dd13629a2f by Eike Hein.
Committed on 15/02/2018 at 18:46.
Pushed by hein into branch 'master'.

Stuff the "Couldn't find executable" message box into a queued lambda

Summary:
This fixes a Plasma shell crash in the Task Manager applet: We
use KRun from inside the onReleased handler of a MouseArea. In
this error case this leads to a KMessageBox spinning the event
loop. The delegate hosting the MouseArea is in the meanwhile
deleted because it's replaced by a different one for the startup
creation. After closing the dialog we're back in the destroyed
delegate and crash.

The patch instead opens the message box from a queued-up lambda
run in the context of qGuiApp (guarded by a test for qGuiApp)
so we escape the caller before starting the nested event loop.

Reviewers: dfaure, davidedmundson, mart

Subscribers: #frameworks

Tags: #frameworks

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

M  +13   -3    src/widgets/krun.cpp

https://commits.kde.org/kio/e3a80661c9cd83677d44f4f6999d24dd13629a2f
Comment 23 Karl Cheng 2018-12-28 12:40:31 UTC
Seems like this has regressed at some point. I cannot pin applications with spaces with them in 5.14.4 but I suspect the regression was before this.
Comment 24 Nate Graham 2018-12-28 14:47:25 UTC
Which app jumps around? And in which distro? And what kind of task manager are you using? Regular Task Manager? Icons-Only Task Manager? Latte Dock? etc.

Works for me with LibreOffice Calc,the latest Plasma, and the IOTM in Manjaro and KDE Neon.
Comment 25 Bug Janitor Service 2019-01-12 04:33:10 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 26 Karl Cheng 2019-01-12 13:20:06 UTC
(In reply to Nate Graham from comment #24)
> Which app jumps around? And in which distro? And what kind of task manager
> are you using? Regular Task Manager? Icons-Only Task Manager? Latte Dock?
> etc.
> 
> Works for me with LibreOffice Calc,the latest Plasma, and the IOTM in
> Manjaro and KDE Neon.

Apologies for not replying earlier.

The issue I noticed was that apps from the Applications Menu are unable to be pinned with spaces in the .desktop file name. For example "LoremIpsum.desktop" will pin fine but "Lorem Ipsum.desktop" does not (appears to have no visible effect when pinned).

The display name (e.g. "LibreOffice Calc") does not affect whether this bug occurs or not.

This can be reproduced with both icons only and normal task manager.

I dont't remember seeing the 'jumping around' problem, but I'm not quite sure how that was meant to be reproduced.

Plasma: 5.14.4
OS: openSUSE Tumbleweed 20190108 (also tested 20181213)
Comment 27 michael 2019-03-15 14:02:26 UTC
Git commit d25cb3a405b9ba93a5cd6c63df82ac70bcacc001 by Michael Reeves.
Committed on 15/03/2019 at 14:01.
Pushed by mreeves into branch 'master'.

use std::list not QList

std::list is close to QLinkedList behavoir wise.
In particular it matches rules about what operations invalidate iterators.
FIXED-IN:1.8

M  +2    -2    src/diff.cpp
M  +3    -1    src/diff.h

https://commits.kde.org/kdiff3/d25cb3a405b9ba93a5cd6c63df82ac70bcacc001
Comment 28 michael 2019-03-15 16:29:18 UTC
Closed wrong bug
Comment 29 Chris 2020-01-14 07:06:44 UTC
(In reply to michael from comment #28)
> Closed wrong bug

Is there any update on the Icon-Only Taskmanager Issue or was a new bug opened?
Icons still jump around on KDE Neon with Plasma 5.17.5 

(Sorry if this is the wrong place to ask)
Comment 30 Kai Uwe Broulik 2020-01-27 13:47:15 UTC
I tried to investigate a little but I think this code makes wrong assumptions.

On one hand it just casually does QUrl::toString() which by default uses QUrl::PrettyDecoded, which tries to avoid as much percent-encoding as possible and as such leaves spaces in tact. On the other hand, the code tries to ignore garbage URLs and as such explicitly constructs URLs with QUrl::StrictMode.

Doing QUrl(url.toString(), QUrl::StrictMode) will naturally produce invalid URLs when the original contained spaces leading to this bug. Using QUrl::toString(FullyDecoded) somewhat works but isn't allowed for this option according to Qt documentation for whatever reason. It would then also result in QUrl("Garbage URL") being treated as valid.

I suggest to drop all of this StrictMode stuff and instead verify if the URL scheme is valid (either file, applications, or preferred).
Comment 31 Alexander Lohnau 2020-06-15 05:56:23 UTC
A duplicate bug of this has been marked as fixed :
https://phabricator.kde.org/D26941

>It should instead generate them percent-encoded, perhaps
>QUrl url;
>url.setScheme("applications");
>url.setPath(menuId);

This is pretty much what you have done when porting away from KRun.

https://invent.kde.org/plasma/plasma-workspace/-/commit/6e660cf92d7c3fb0e20527866691eaff9f8bc207

Also the regression caused by this has been fixed:

https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/61

And it now works as expected.
Comment 32 Nate Graham 2020-07-12 04:50:50 UTC
*** Bug 393665 has been marked as a duplicate of this bug. ***
Comment 33 Nate Graham 2020-07-12 04:50:54 UTC
*** Bug 385727 has been marked as a duplicate of this bug. ***