Bug 391128 - Process name change isn’t reflected in tabbar after using exec
Summary: Process name change isn’t reflected in tabbar after using exec
Status: RESOLVED FIXED
Alias: None
Product: konsole
Classification: Applications
Component: tabbar (show other bugs)
Version: 20.12.3
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Konsole Developer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-02-26 21:48 UTC by ariasuni
Modified: 2023-09-10 13:14 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ariasuni 2018-02-26 21:48:30 UTC
When using exec in current shell, the last process name is still reflected in the tabbar.

For example, I use a `~/.bashrc` with `exec fish` so that launching Bash in interactive mode is replaced with fish (because fish as a default shell breaks e.g. Plasma). In this case, Konsole reports `bash` as the current process.

Note that when launching e.g. htop, it reports correctly the current process name, but when returning to the shell it still displays the wrong name (bash in my case).
Comment 1 Kurt Hindenburg 2018-03-01 03:00:14 UTC
Following your steps, it works here on master and the 17.12 branch.  You are using the default format %d : %n ?
Comment 2 Kurt Hindenburg 2018-03-01 03:04:55 UTC
OK if you bash as the profile's command, it doesn't work.

It does work if you start from a zsh shell.
Comment 3 ariasuni 2018-03-01 09:10:10 UTC
Here is a demonstration:

> bash  # Command
[bash]  # Process reported by Konsole (%n)
>exec zsh
[bash]
> htop
[htop]
# I quit htop
[bash]  # Konsole seems to keep process name in memory
> zsh
[zsh]
> exec fish
[zsh]
> fish
[fish]
Comment 4 ariasuni 2018-03-01 09:13:37 UTC
Sorry for the formatting (I should have used preview!), here is a more readable version:

$ bash
[bash] # Process reported by Konsole (%n)

$ exec zsh
[bash]

$ htop
[htop]

// I quit htop
[bash] (Konsole seems to keep process name in memory)

$ zsh
[zsh]

$ exec fish
[zsh]

$ fish
[fish]
Comment 5 ariasuni 2018-08-28 08:00:51 UTC
I still have this problem in Konsole 18.08.0, KDE Frameworks 5.49.0.
Comment 6 Bug Janitor Service 2023-06-18 09:23:04 UTC
A possibly relevant merge request was started @ https://invent.kde.org/utilities/konsole/-/merge_requests/864
Comment 7 Kurt Hindenburg 2023-09-10 13:14:37 UTC
Git commit 25f8ebf9b67be936a60e2d45f69391378ce56788 by Kurt Hindenburg, on behalf of Theodore Wang.
Committed on 10/09/2023 at 15:14.
Pushed by hindenburg into branch 'master'.

Periodically check and update ProcessInfo::_name

Currently, there is an issue where 'exec [program]' results in tab
titles not being updated and not showing the process name as [program].
This is probably due to how 'exec' does not result in any change in
pid and simply replaces the current process image with a different one.

Due to a lack of pid changes, Session::updateSessionProcessInfo will not
call ProcessInfo::newInstance, thus not updating the ProcessInfo::_name.

This new change periodically checks and updates the _name of ProcessInfo
through ProcessInfo::readProcessName, which is called by
ProcessInfo::update.

M  +5    -0    src/NullProcessInfo.cpp
M  +1    -0    src/NullProcessInfo.h
M  +149  -67   src/ProcessInfo.cpp
M  +7    -0    src/ProcessInfo.h
M  +27   -0    src/UnixProcessInfo.cpp
M  +17   -0    src/UnixProcessInfo.h

https://invent.kde.org/utilities/konsole/-/commit/25f8ebf9b67be936a60e2d45f69391378ce56788