`tmux -d -x ... -y ...` does not respect sizing
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
tmux (Ubuntu) |
Fix Released
|
Medium
|
Utkarsh Gupta | ||
Jammy |
Fix Released
|
Medium
|
Utkarsh Gupta |
Bug Description
[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:/
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 df3fe2aa72da055
$ ./autogen.sh >& /dev/null && ./configure --prefix=
tmux 3.2a
20
```
so all that should be needed is to apply that patch:
```diff
commit df3fe2aa72da055
Author: Nicholas Marriott <email address hidden>
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_
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!
Related branches
- git-ubuntu bot: Approve
- Lena Voytek (community): Approve
- Canonical Server packageset reviewers: Pending requested
- Canonical Server Reporter: Pending requested
-
Diff: 57 lines (+35/-0)3 files modifieddebian/changelog (+7/-0)
debian/patches/lp1976110-respect-sizing.diff (+27/-0)
debian/patches/series (+1/-0)
Changed in tmux (Ubuntu Jammy): | |
assignee: | nobody → Utkarsh Gupta (utkarsh) |
I have made a PPA including that patch in case anyone wants to try it out:
- source code here: https:/ /github. com/asottile/ tmux-jammy /launchpad. net/~asottile/ +archive/ ubuntu/ tmux-jammy
- PPA here: https:/