Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 934732 - app-shells/bash: bash shouldn't be made to emit the Title Definition String escape sequence
Summary: app-shells/bash: bash shouldn't be made to emit the Title Definition String e...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-06-22 12:37 UTC by RumpletonBongworth
Modified: 2024-06-22 20:29 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
bash-no-screen-tmux-title.patch (bash-no-screen-tmux-title.patch,2.74 KB, patch)
2024-06-22 17:05 UTC, Sven Wegener
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description RumpletonBongworth 2024-06-22 12:37:59 UTC
This is split out from https://bugs.gentoo.org/934309#c5, in which Sven Wegener comments as follows.

---

As the screen maintainer I need to comment on the recent title changes, which are wrong from my point of view.

For both screen and tmux the window title that is updated with the k escape sequence is an alias that is given to the window by the user and the alias can be used to reference the window in commands, e.g. "select <alias>" in screen or "select-window -t <alias>" in tmux to switch to a window by name. This is why the title should not be changed by applications running inside of screen or tmux.

Also the k escape sequences in tmux changes the window title and not the pane title like is written in the comment of genfun_set_pane_title, making the result of the window title arbitrary for windows with multiple panes in them.

Both screen and tmux support a title string like the xterm title. In screen, this is called the hardstatus line and tmux calles it the pane title. Both are updated by the xterm title sequence as part of genfun_set_win_title and both forward the title to the terminal.

As said, I consider these changes wrong and am preparing a patch to remove genfun_set_pane_title from the bashrc.
Comment 1 RumpletonBongworth 2024-06-22 12:56:15 UTC
My response is as follows.

---

> As the screen maintainer I need to comment on the recent title changes,
> which are wrong from my point of view.
> 
> For both screen and tmux the window title that is updated with the k escape
> sequence is an alias that is given to the window by the user and the alias
> can be used to reference the window in commands, e.g. "select <alias>" in
> screen or "select-window -t <alias>" in tmux to switch to a window by name.
> This is why the title should not be changed by applications running inside
> of screen or tmux.

Thanks for bringing this up. There is no disputing any of this. Nor do I wish for any particular use case to be coerced. It - as in genfun_set_pane_title - can be removed.

In the case of tmux, I would add that it would have required for the user to opt in by turning on the "allow-rename" feature.

> Also the k escape sequences in tmux changes the window title and not the
> pane title like is written in the comment of genfun_set_pane_title, making
> the result of the window title arbitrary for windows with multiple panes in
> them.

I was aware that it sets the window title. I am not sure how I managed to bungle the comments but simply hadn't noticed until you brought it up. It's a little embarrassing as I try hard to to write accurate commentary.

> Both screen and tmux support a title string like the xterm title. In screen,
> this is called the hardstatus line and tmux calles it the pane title. Both
> are updated by the xterm title sequence as part of genfun_set_win_title and
> both forward the title to the terminal.

You may just have opened up a rabbit hole for me to dive into there. On some systems, including the one on which I primarily do my work, I find that it is necessary to explicitly enable the "set-titles" option for this to be the case (then to set "set-titles-string" as "#T" for the title be forwarded verbatim if desired). Yet, on other systems, I can see that "set-titles" is enabled from the outset.

> As said, I consider these changes wrong and am preparing a patch to remove
> genfun_set_pane_title from the bashrc.

I regret having inconvenienced you. Given that you have begun preparing a patch, I'll wait for another 24 hours. If nothing is submitted within that time, I'll attach my own patch here for review.
Comment 2 Sven Wegener gentoo-dev 2024-06-22 17:05:14 UTC
Created attachment 896257 [details, diff]
bash-no-screen-tmux-title.patch

Thanks for taking this into its own bug, it clearly doesn't fit into the other one, I had the other bugs open and chose the wrong one.

(In reply to RumpletonBongworth from comment #1)
> My response is as follows.
> 
> ---
> 
> > As the screen maintainer I need to comment on the recent title changes,
> > which are wrong from my point of view.
> > 
> > For both screen and tmux the window title that is updated with the k escape
> > sequence is an alias that is given to the window by the user and the alias
> > can be used to reference the window in commands, e.g. "select <alias>" in
> > screen or "select-window -t <alias>" in tmux to switch to a window by name.
> > This is why the title should not be changed by applications running inside
> > of screen or tmux.
> 
> Thanks for bringing this up. There is no disputing any of this. Nor do I
> wish for any particular use case to be coerced. It - as in
> genfun_set_pane_title - can be removed.
> 
> In the case of tmux, I would add that it would have required for the user to
> opt in by turning on the "allow-rename" feature.

screen is missing a lot of configuration options like that. I also just saw that tmux is getting an "allow-set-title" option for controlling the pane title change, being on by default.

> > Also the k escape sequences in tmux changes the window title and not the
> > pane title like is written in the comment of genfun_set_pane_title, making
> > the result of the window title arbitrary for windows with multiple panes in
> > them.
> 
> I was aware that it sets the window title. I am not sure how I managed to
> bungle the comments but simply hadn't noticed until you brought it up. It's
> a little embarrassing as I try hard to to write accurate commentary.

Did not want to focus on the mistake in the wording, was trying to reinforce the point that changing the window name causes issues. I like that your commit messages contain a lot of information!

> > Both screen and tmux support a title string like the xterm title. In screen,
> > this is called the hardstatus line and tmux calles it the pane title. Both
> > are updated by the xterm title sequence as part of genfun_set_win_title and
> > both forward the title to the terminal.
> 
> You may just have opened up a rabbit hole for me to dive into there. On some
> systems, including the one on which I primarily do my work, I find that it
> is necessary to explicitly enable the "set-titles" option for this to be the
> case (then to set "set-titles-string" as "#T" for the title be forwarded
> verbatim if desired). Yet, on other systems, I can see that "set-titles" is
> enabled from the outset.

Hm, it used to be on by default in the early days of tmux. And I guess, with having a custom tmux.conf around and having enabled "set-titles" on nearly all systems, I also wrongly assumed that it would be on by default in tmux like in screen.

> > As said, I consider these changes wrong and am preparing a patch to remove
> > genfun_set_pane_title from the bashrc.
> 
> I regret having inconvenienced you. Given that you have begun preparing a
> patch, I'll wait for another 24 hours. If nothing is submitted within that
> time, I'll attach my own patch here for review.

All good, it kind of triggered me, because this issue came up in the past. See the attached patch I'm going to commit.
Comment 3 RumpletonBongworth 2024-06-22 17:13:20 UTC
Thanks, Sven. The patch looks good to me.
Comment 4 RumpletonBongworth 2024-06-22 17:32:15 UTC
I just realised that there is an opportunity to fix a grammatical error in the course of applying it.

"title bar be affected" => "title bar to be affected"
Comment 5 Larry the Git Cow gentoo-dev 2024-06-22 20:29:53 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9ff9f8199ccf9d55fb1cf066cbbc791101894ab0

commit 9ff9f8199ccf9d55fb1cf066cbbc791101894ab0
Author:     Sven Wegener <swegener@gentoo.org>
AuthorDate: 2024-06-22 16:47:32 +0000
Commit:     Sven Wegener <swegener@gentoo.org>
CommitDate: 2024-06-22 20:26:45 +0000

    app-shells/bash: do not update internal window title of screen and tmux
    
    The k escape sequence changes the internal window title of screen and
    tmux, which is an alias given to the window by the user. The alias can
    be used to reference the window in internal commands, e.g. by using
    "select <alias>" in screen or "select-window -t <alias>" in tmux to
    switch to a window by name, and should not be updated by commands
    running inside of screen and tmux.
    
    Closes: https://bugs.gentoo.org/934732
    Signed-off-by: Sven Wegener <swegener@gentoo.org>

 .../bash/files/bashrc.d/10-gentoo-title.bash       | 32 ++++++----------------
 1 file changed, 9 insertions(+), 23 deletions(-)