2022-11-23 12:22:52 |
Utkarsh Gupta |
description |
source package: https://packages.ubuntu.com/en/source/jammy/tmux
this was a bug in tmux 3.2a -- it has since been fixed on tmux master
here is my system information:
```console
$ dpkg -l | grep tmux
ii tmux 3.2a-4build1 amd64 terminal multiplexer
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04 LTS
Release: 22.04
Codename: jammy
```
you can reproduce this pretty easily with:
```bash
tmux -V
tmux new-session -d -x 20 -y 20 bash
tmux send-keys 'tput cols'
tmux send-keys 'Enter'
sleep 1
tmux capture-pane -pt0 | grep -Eo '^[0-9]+'
tmux kill-session
```
on 20.04, I get the following:
```console
$ bash t.sh tmux 3.0a
20
```
on 22.04 I get the following (my parent window is 118 wide):
```console
$ bash t.sh
tmux 3.2a
118
```
I've gone ahead and bisected to find the patch that's needed to fix this -- it was originally committed here: https://github.com/tmux/tmux/commit/df3fe2aa72da0555106c6187e750418f0e59d901
applying that to the packaging of 3.2a should be pretty straightforward, I've verified that applying it fixes the problem:
```console
$ git checkout 3.2a
$ git cherry-pick df3fe2aa72da0555106c6187e750418f0e59d901
$ ./autogen.sh >& /dev/null && ./configure --prefix=$PWD/prefix >& /dev/null && make -j5 >& /dev/null && make install >& /dev/null && PATH=/tmp/tmux/prefix/bin:$PATH bash ../t.sh
tmux 3.2a
20
```
so all that should be needed is to apply that patch:
```diff
commit df3fe2aa72da0555106c6187e750418f0e59d901 (refs/bisect/skip-df3fe2aa72da0555106c6187e750418f0e59d901)
Author: Nicholas Marriott <nicholas.marriott@gmail.com>
Date: Tue Jul 13 10:38:57 2021 +0000
Only use client for sizing when not detached, GitHub issue 2772.
diff --git a/cmd-new-session.c b/cmd-new-session.c
index 666aeaac..033c707f 100644
--- a/cmd-new-session.c
+++ b/cmd-new-session.c
@@ -280,7 +280,8 @@ cmd_new_session_exec(struct cmd *self, struct cmdq_item *item)
memset(&sc, 0, sizeof sc);
sc.item = item;
sc.s = s;
- sc.tc = c;
+ if (!detached)
+ sc.tc = c;
sc.name = args_get(args, 'n');
sc.argc = args->argc;
```
thanks! |
[Impact]
========
I use tmux for testing a CLI app on different terminal sizes. I noticed that after upgrading to 3.2a from 3.2, the -x and -y parameters I pass to tmux new-session -d does not take effect.
The below command outputs are from terminals with the same size:
$ tmux -V
tmux 3.2a
$ rm bar; tmux new-session -d -x 20 -y 10 'tput cols > bar'; sleep 0.1; cat bar
174
$ tmux -V
tmux 3.2
$ rm bar; tmux new-session -d -x 20 -y 10 'tput cols > bar'; sleep 0.1; cat bar
20
Also, the default size has also changed, where 3.2 always spawns a detached window of width 80 regardless of the terminal size, however 3.2a uses the width of the terminal I used to spawn it.
[Test Plan]
===========
You can reproduce this pretty easily with:
$ lxc launch images:ubuntu/jammy jtemp --vm
# apt upadte && apt install tmux
### change to a user - not really needed but I have a user configured.
$ tmux -V
$ tmux new-session -d -x 20 -y 20 bash
$ tmux send-keys 'tput cols'
$ tmux send-keys 'Enter'
$ sleep 1
$ tmux capture-pane -pt0 | grep -Eo '^[0-9]+'
$ tmux kill-session
on 20.04, I get the following:
```console
$ bash t.sh tmux 3.0a
20
```
on 22.04 I get the following (my parent window is 118 wide):
```console
$ bash t.sh
tmux 3.2a
118
```
[Regression Potential]
======================
There might be a corner case where a user might face a regression if they have done some workarounds to this issue but that should be really minimal (if not zero). The patch is really trivial and is really targeted (see the if clause) so the chances of actual regression is also really minimal.
[Other Information]
===================
I've gone ahead and bisected to find the patch that's needed to fix this -- it was originally committed here: https://github.com/tmux/tmux/commit/df3fe2aa72da0555106c6187e750418f0e59d901
applying that to the packaging of 3.2a should be pretty straightforward, I've verified that applying it fixes the problem:
```console
$ git checkout 3.2a
$ git cherry-pick df3fe2aa72da0555106c6187e750418f0e59d901
$ ./autogen.sh >& /dev/null && ./configure --prefix=$PWD/prefix >& /dev/null && make -j5 >& /dev/null && make install >& /dev/null && PATH=/tmp/tmux/prefix/bin:$PATH bash ../t.sh
tmux 3.2a
20
```
so all that should be needed is to apply that patch:
```diff
commit df3fe2aa72da0555106c6187e750418f0e59d901 (refs/bisect/skip-df3fe2aa72da0555106c6187e750418f0e59d901)
Author: Nicholas Marriott <nicholas.marriott@gmail.com>
Date: Tue Jul 13 10:38:57 2021 +0000
Only use client for sizing when not detached, GitHub issue 2772.
diff --git a/cmd-new-session.c b/cmd-new-session.c
index 666aeaac..033c707f 100644
--- a/cmd-new-session.c
+++ b/cmd-new-session.c
@@ -280,7 +280,8 @@ cmd_new_session_exec(struct cmd *self, struct cmdq_item *item)
memset(&sc, 0, sizeof sc);
sc.item = item;
sc.s = s;
- sc.tc = c;
+ if (!detached)
+ sc.tc = c;
sc.name = args_get(args, 'n');
sc.argc = args->argc;
```
thanks! |
|