SUMMARY Since https://invent.kde.org/utilities/konsole/-/merge_requests/830, the argument “--env=TERM=xterm-256color” is appended as the last but one argument in Konsole's start command. This is not noticeable by default, because the start command is just the shell (e.g. /bin/bash); being annexed to flatpak-spawn instead, as intended. However, if the user passes one or more args, the TERM env variable will be passed to the start command (be it the shell or something else) instead of flatpak-spawn. STEPS TO REPRODUCE 1. Open a terminal or KRunner 2. Run `flatpak run org.kde.konsole --hold -e /bin/echo Example` OBSERVED RESULT Konsole shows “--env=TERM=xterm-256color Example“, because --env=TERM=xterm-256color was passed as an argument. EXPECTED RESULT Konsole should show just “Example”. “--env=TERM=xterm-256color” should be passed to flatpak-spawn and not the user-provided command. SOFTWARE/OS VERSIONS Konsole Version: 24.12.0 Operating System: Fedora Linux 41 Flatpak runtime: org.kde.Platform/x86_64/6.8 KDE Frameworks Version: 6.8.0 (6.9.0 inside the runtime) Qt Version: 6.8.0 ADDITIONAL INFORMATION This behaviour prevents me from using Konsole as a Flatpak with my current profile. When I launch the Konsole Flatpak with a custom command: ``` [General] Command=/bin/bash --init-file $HOME/.local/share/bash/bashrc ``` Konsole closes immediately upon launch. If launched with the --hold option, bash gives the following error: line 11: return: can only `return' from a function or sourced script. I discovered afterwards that the real command that was being executed was: /bin/bash --init-file --env=TERM=xterm-256color $HOME/.local/share/bash/bashrc If any arguments besides the shell/program binary are provided, Konsole will always append “--env=TERM=xterm-256color” before the last argument.
A possibly relevant merge request was started @ https://invent.kde.org/utilities/konsole/-/merge_requests/1052
A possibly relevant merge request was started @ https://invent.kde.org/utilities/konsole/-/merge_requests/1053
Git commit a114a162152de31ed90e1409258a4c33452e02d7 by Kurt Hindenburg, on behalf of Anael González Paz. Committed on 20/12/2024 at 16:35. Pushed by hindenburg into branch 'master'. Fix TERM env argument being misplaced in Flatpak As it was previously, it only worked as intended if the user had only the binary as the start command (e.g. /bin/bash). Otherwise, it would had appended the flatpak-spawn related argument after the start command program. Instead of passing the start command args to KSandbox::makeHostContext, this will append them to the ones returned by makeHostContext on the 'postProcessArgs' function. In case Konsole is being run as a Flatpak, all of said args would be added after '--env=TERM=xterm-256color' and the program name. M +5 -5 src/session/Session.cpp https://invent.kde.org/utilities/konsole/-/commit/a114a162152de31ed90e1409258a4c33452e02d7