Bug 500040 - Flatpak Konsole inserting --env breaks some commands
Summary: Flatpak Konsole inserting --env breaks some commands
Status: RESOLVED DUPLICATE of bug 497519
Alias: None
Product: konsole
Classification: Applications
Component: general (show other bugs)
Version: 24.12.2
Platform: Flatpak Linux
: NOR normal
Target Milestone: ---
Assignee: Konsole Developer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-02-14 04:10 UTC by Tom
Modified: 2025-02-18 06:25 UTC (History)
1 user (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 Tom 2025-02-14 04:10:18 UTC
SUMMARY

In the case of Konsole running through Flatpak, it adds `--env=TERM=xterm-256color` to the arguments of run commands.  The issue is that it can be inserted in the middle of commands, so it's not being passed to Flatpak as intended, but to the user command which will not understand that argument.

My distro recently dropped Konsole from its base image, requiring users to install it through Flatpak instead, so I'm having this issue in a number of places.  For example, the system update program's .desktop file runs `ujust update` in a terminal, and my default terminal is Konsole, but this no longer works because ujust doesn't understand the added argument.

STEPS TO REPRODUCE
1. `konsole --hold -e /usr/bin/bash -c 'echo hi'`

OBSERVED RESULT

```
/usr/bin/bash: --: invalid option
Usage...
```

The `--env` argument is being inserted *after* bash, and of course bash doesn't understand it.  I believe this is because the code is assuming commands are just one word, popping once, adding `--env`, and pushing the one word back on.

EXPECTED RESULT

I would expect this to start bash to run an echo command.  Konsole documentation says everything after `-e` is taken as a command to run.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Bazzite 41; kernel 6.12.12
KDE Plasma Version: 6.2.5
KDE Frameworks Version: 6.10.0
Qt Version: 6.8.2

ADDITIONAL INFORMATION

The relevant code: https://invent.kde.org/utilities/konsole/-/blob/5386a0e59d968dd057f318aaf5c70eb15b8e9784/src/session/Session.cpp#L462
From this commit: https://invent.kde.org/utilities/konsole/-/commit/646c935892fa6c0b4cfae3ae8c990ee6e9956f0e
From this MR: https://invent.kde.org/utilities/konsole/-/merge_requests/830
Comment 1 Tom 2025-02-18 06:25:55 UTC
Sorry - just saw bug 497519, which this duplicates.  It was fixed in commit a114a162152de31ed90e1409258a4c33452e02d7.  Thanks!

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