Bug 460387 - desktopexec parser always prepends "-e" to cmdline when invoking terminal applications
Summary: desktopexec parser always prepends "-e" to cmdline when invoking terminal app...
Status: RESOLVED DUPLICATE of bug 459616
Alias: None
Product: frameworks-kio
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 5.99.0
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KIO Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-10-13 19:33 UTC by magnus.gross21
Modified: 2022-10-14 19:09 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description magnus.gross21 2022-10-13 19:33:11 UTC
SUMMARY
When configuring some terminal application as the default application for some filetype and then opening that file type with "xdg-open", KDE will start that application by passing the cmdline of the desktop file to the terminal emulator with "-e" prepended.

Basically, KDE assumes that every terminal emulator uses and understands "-e" to pass the cmdline.
But this is not universally true for every terminal emulator, for example not for wezterm.

I already tried reporting the bug at wezterm here: https://github.com/wez/wezterm/issues/2622
But the maintainer wanted to at least discuss this first on the KDE side - rightfully so, as passing the cmdline with "-e" is not standard, and not officially defined in the XDG spec.

The offending code in kio can be found here: https://github.com/KDE/kio/blob/ad27f0e299e7a7a1f4059431f882f9a4ebba71fd/src/core/desktopexecparser.cpp#L532

I understand it is probably not possible to completely remove the "-e" thing, as other terminals such as konsole expect the cmdline like this, but do you think it is possible to implement a workaround in KDE that automatically detects which applications need "-e" and which ones don't?


STEPS TO REPRODUCE
1. Configure wezterm as the default terminal emulator in KDE Settings
2. Configure terminal vim as the default application for opening .txt files (The vim desktop file must contain "Terminal=true")
3. Open an arbitrary text file with "xdg-open /tmp/file.txt"

OBSERVED RESULT
KDE assumes that the terminal emulator uses and understands "-e" to get the cmdline, but that is not the case for every terminal emulator including wezterm, which prints the following error:

"ERROR  wezterm_gui > Unable to spawn -e because it doesn't exist on the filesystem and was not found in PATH; terminating"

EXPECTED RESULT
KDE does not pass the cmdline with "-e", after all the desktop file of wezterm is already configured to support passing cmdlines:
Exec=wezterm start --cwd . --

Thus, KDE should only pass the cmdline as given in the vim desktop file to wezterm's Exec line, not prepend it with "-e".

KDE Plasma Version: 5.26.0
KDE Frameworks Version: 5.99
Qt Version: 6.4/5.15
Comment 1 Nate Graham 2022-10-14 19:09:46 UTC

*** This bug has been marked as a duplicate of bug 459616 ***