Bug 423412

Summary: Dolphin can't properly run script if there is space in the path
Product: [Frameworks and Libraries] frameworks-kio Reporter: Alex Fliker <alex.kdebugzilla>
Component: generalAssignee: KIO Bugs <kio-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: a.samirh78, alex.kdebugzilla, kdelibs-bugs, kfm-devel, mo78, nate, tobias.klausmann
Priority: NOR Keywords: regression
Version: 5.71.0   
Target Milestone: ---   
Platform: Neon   
OS: Linux   
Latest Commit: Version Fixed In: 5.72
Sentry Crash Report:
Attachments: possible fix

Description Alex Fliker 2020-06-23 21:44:13 UTC
STEPS TO REPRODUCE
1. Have a path like '/storage/Programs/Astronomy/ISS Transit Predictor'
2. Launch a script in this directory by choosing Execute when prompted

OBSERVED RESULT
Nothing happens. Clue is given by running Dolphin in terminal: '/bin/sh: 1: /storage/Programs/Astronomy/ISS: not found'

EXPECTED RESULT
Properly handling the path containing the space and executing the script

SOFTWARE/OS VERSIONS
Operating System: KDE neon 5.19
KDE Plasma Version: 5.19.1
KDE Frameworks Version: 5.71.0
Qt Version: 5.14.2
Kernel Version: 5.4.0-38-generic
OS Type: 64-bit
Comment 1 Tobias Klausmann 2020-06-24 10:36:35 UTC
I can confirm this behavior and noting that this worked in previous releases, so its most likely a recent regression

/Wine/Program Files/test.sh ->
/bin/sh: /Wine/Program: Datei oder Verzeichnis nicht gefunden

SOFTWARE/OS VERSIONS
Operating System: openSUSE Tumbleweed
KDE Plasma Version: 5.19.1
KDE Frameworks Version: 5.71.0
Qt Version: 5.15.0
Comment 2 Tobias Klausmann 2020-06-24 19:22:38 UTC
Created attachment 129642 [details]
possible fix

While debugging i found this to involve several components (Dolphin, kio, kcoreaddons), yet the seemingly easiest solution seems to be in kios CommandLauncherJob. A diff to fix the described regression is attached (I know this is not the way to upstream patches, yet i wanted it to discuss first)
Comment 3 Nate Graham 2020-06-24 21:05:55 UTC
Nice. Looks like a sensible fix to me. BTW submitting directly is often the best way to have that discussion, so please submit it over here: https://invent.kde.org/frameworks/kio/-/merge_requests/

In your commit message, you can add `Bug: 423412` on its own line and it will automatically close this when merged.
Comment 4 Bug Janitor Service 2020-06-28 22:48:40 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kio/-/merge_requests/69
Comment 5 Ahmad Samir 2020-06-29 09:59:31 UTC
Git commit 8d6b306f585920230acecd19903325f6f0387b8e by Ahmad Samir, on behalf of David Faure.
Committed on 29/06/2020 at 09:58.
Pushed by ahmadsamir into branch 'master'.

OpenUrlJob: fix support for shell scripts with a space in the filename

When executing a shell script or an executable in dolphin in a folder with a blank
e.g. "/my test/test.sh" the path was truncated to "/my" and the command was not executed.

Document the API trap.
Related: bug 423645
FIXED-IN: 5.72

M  +2    -0    src/gui/commandlauncherjob.h
M  +1    -1    src/gui/openurljob.cpp

https://invent.kde.org/frameworks/kio/commit/8d6b306f585920230acecd19903325f6f0387b8e
Comment 6 Nate Graham 2020-07-02 01:18:14 UTC
*** Bug 423701 has been marked as a duplicate of this bug. ***
Comment 7 Ahmad Samir 2020-07-08 17:00:28 UTC
*** Bug 423578 has been marked as a duplicate of this bug. ***