Bug 503344

Summary: Application start fails for files within a directory ending in a space
Product: [Plasma] plasmashell Reporter: Malte S. Stretz <mss>
Component: generalAssignee: Plasma Bugs List <plasma-bugs-null>
Status: RESOLVED DUPLICATE    
Severity: normal CC: john.kizer, kde
Priority: NOR    
Version First Reported In: 6.3.4   
Target Milestone: 1.0   
Platform: Neon   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Malte S. Stretz 2025-04-25 15:17:26 UTC
SUMMARY
I think this is an issue in the systemd integration but I couldn't find a matching component (or maybe product).

Originally my partner encountered this when she tried to open a picture in Gwenview in a folder which happened to end in a space (for whatever reasons: by clicking on it in Dolphin. Below are steps to reproduce this via the shell.

It looks like the WorkingDirectory option in the dynamically (?) generated systemd unit is not set correctly.


STEPS TO REPRODUCE
mkdir ${XDG_RUNTIME_DIR:-/run/user/$(id -n)}/spacetest
cd ${XDG_RUNTIME_DIR:-/run/user/$(id -n)}/spacetest
mkdir 1 '2 ' # note the trailing space for the second folder
echo foo | tee 1/test.txt '2 /test.txt'

journalctl -n 0 --cursor-file=cursor
xdg-open 1/test.txt # this works

xdg-open '2 /test.txt' # no new kwrite
journalctl --cursor-file=cursor

OBSERVED RESULT

First KWrite startes, second doesn't:

> Apr 25 17:12:03 localhost systemd[1449]: Started app-org.kde.kwrite@20ca3cb0cad24040886911becdb4f2e9.service - KWrite - Text Editor.
> Apr 25 17:12:03 localhost kwrite[142123]: libkate.time: All plugins loaded in 0 ms
> Apr 25 17:12:03 localhost kwrite[142123]: libkate.time: Created KateMainWindow in 62 ms
> Apr 25 17:12:10 localhost systemd[1449]: Started app-org.kde.kwrite@2dc65ec6abb047f2bf75df452d544ea7.service - KWrite - Text Editor.
> Apr 25 17:12:10 localhost (kwrite)[142197]: app-org.kde.kwrite@2dc65ec6abb047f2bf75df452d544ea7.service: Changing to the requested working directory failed: No such file or directory
> Apr 25 17:12:10 localhost systemd[1449]: app-org.kde.kwrite@2dc65ec6abb047f2bf75df452d544ea7.service: Main process exited, code=exited, status=200/CHDIR
> Apr 25 17:12:10 localhost systemd[1449]: app-org.kde.kwrite@2dc65ec6abb047f2bf75df452d544ea7.service: Failed with result 'exit-code'.

EXPECTED RESULT

Two KWrites

SOFTWARE/OS VERSIONS
Operating System: KDE neon 6.3
KDE Plasma Version: 6.3.4
KDE Frameworks Version: 6.13.0
Qt Version: 6.8.3
Kernel Version: 6.11.0-24-generic (64-bit)
Graphics Platform: Wayland

ADDITIONAL INFORMATION

systemctl --user cat app-org.kde.kwßrite@2dc65ec6abb047f2bf75df452d544ea7.service | sed -e '/WorkingDirectory/!d' -e 's/$/EOL/'
WorkingDirectory=/run/user/1000/spacetest/2 EOL
Comment 1 John Kizer 2025-04-26 06:05:22 UTC
Hi - merging this with the existing bug report for this issue. It looks like upstream systemd has resolved it, but perhaps the Ubuntu base for KDE Neon hasn't yet patched their version of systemd to include this.

Thanks!

*** This bug has been marked as a duplicate of bug 491192 ***
Comment 2 Malte S. Stretz 2025-04-26 10:11:21 UTC
Thanks for the quick resolution, I somehow didn't find that other issue when filing this.

Looks like the relevant change in systemd is 9be46b1da8b01c3f47e6c050185f2b45484d6300 and that won't be fixed until v257 which is only part of Ubuntu 25.04 (Neon is based on 24.04). Since this is quite an esoteric issue I don't think it is worth backporting.