regression: splitting panes does not cause a resize in backgrounded tmux

Bug #1875109 reported by Anthony Sottile
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
tmux (Ubuntu)
Undecided
Unassigned
Focal
Undecided
Sergio Durigan Junior
Groovy
Undecided
Unassigned

Bug Description

[Impact]

This is a fix to a problem that happens when the user splits up tmux windows (using 'split-window') while running tmux in the background (i.e., not attached to a pty). In this scenario, tmux should automatically resize the panes and the applications running inside them, but it doesn't.

The cherry-picked fix, which has been pushed upstream already, can be found at:

https://github.com/tmux/tmux/commit/bad95db8785f4ee6b6e17750500c024642e83134

[Test Case]

To reproduce the bug, one can use a slightly modified version of the upstream bug reporter's script.

$ lxc launch ubuntu-daily:focal tmux-bug1875109
$ lxc shell tmux-bug1875109
# apt update && apt install tmux
# cat > reproducer.sh << __EOF__
#!/usr/bin/env bash
set -euo pipefail

TMUX="tmux"

tmux_cmd() { "${TMUX}" -u -L demo-session "$@"; }
msg() { echo -e "\033[1m+ $*\033[m"; }

msg tmux version
"${TMUX}" -V

msg starting tmux...
tmux_cmd new-session -d -x 80 -y 8 nano --ignorercfiles
sleep .5
tmux_cmd send-keys -t0 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
tmux_cmd send-keys -t0 Enter
sleep .5

msg 'this is nano at full width:'
tmux_cmd capture-pane -pt0

tmux_cmd split-window -ht0 -l 50 sleep infinity
sleep .5

msg 'this is nano at smaller width (should have "Modified" + $ at eol):'
tmux_cmd capture-pane -pt0

msg 'trying to grep Modified'
if ! tmux_cmd capture-pane -pt0 | grep Modified; then
  msg "@@@@@@@@ BUG DETECTED @@@@@@@@"
else
  msg "@@@@@@@@ NO BUG FOUND @@@@@@@@"
fi

msg cleaning up...
tmux_cmd kill-pane -t1
# quit nano to exit tmux
tmux_cmd send-keys -t0 '^X'
tmux_cmd send-keys -t0 'n'
sleep .5
tmux_cmd kill-session >& /dev/null || true
__EOF__
# chmod +x reproducer.sh
# ./reproducer.sh

Look for "@@@@@@@@ BUG DETECTED @@@@@@@@" in the output.

[Regression Potential]

* The fix is extremely simple and self-contained: it teaches tmux to detect whether a window is in an unattached session, and resizes it in this case.

* The changes are localized to the client's screen drawing behaviour, so irregularities in drawing behaviour would be what to watch for with regressions.

[Original Description]

This is the same as this upstream issue: https://github.com/tmux/tmux/issues/1963 (fixed 2019-11-02)

this is present in 3.0a-2 for ubuntu focal

there is a patch listed here -- alternatively, it looks like this is fixed in 3.1: https://github.com/tmux/tmux/issues/1963#issuecomment-548929945

Related branches

Changed in tmux (Ubuntu Focal):
status: New → Triaged
Changed in tmux (Ubuntu Groovy):
status: New → Triaged
Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

I'll take a look at this one.

Changed in tmux (Ubuntu Focal):
assignee: nobody → Sergio Durigan Junior (sergiodj)
Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

I'm marking this as "Fix Released" for groovy since the bug doesn't happen there because we ship version 3.1b-1.

description: updated
Changed in tmux (Ubuntu Groovy):
status: Triaged → Fix Released
description: updated
Revision history for this message
Robie Basak (racb) wrote : Please test proposed package

Hello Anthony, or anyone else affected,

Accepted tmux into focal-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/tmux/3.0a-2ubuntu0.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-focal to verification-done-focal. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-focal. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in tmux (Ubuntu Focal):
status: Triaged → Fix Committed
tags: added: verification-needed verification-needed-focal
Revision history for this message
Anthony Sottile (asottile) wrote :

can confirm this is fixed in the proposed version -- thanks!

(venv) root@76a706fdb5e0:/babi# apt update -qq && apt install tmux
7 packages can be upgraded. Run 'apt list --upgradable' to see them.
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be upgraded:
  tmux
1 upgraded, 0 newly installed, 0 to remove and 6 not upgraded.
Need to get 292 kB of archives.
After this operation, 3072 B disk space will be freed.
Get:1 http://archive.ubuntu.com/ubuntu focal-proposed/main amd64 tmux amd64 3.0a-2ubuntu0.1 [292 kB]
Fetched 292 kB in 1s (279 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
(Reading database ... 8572 files and directories currently installed.)
Preparing to unpack .../tmux_3.0a-2ubuntu0.1_amd64.deb ...
Unpacking tmux (3.0a-2ubuntu0.1) over (3.0a-2) ...
Setting up tmux (3.0a-2ubuntu0.1) ...
(venv) root@76a706fdb5e0:/babi# pytest tests -k resize
============================= test session starts ==============================
platform linux -- Python 3.8.2, pytest-5.4.2, py-1.8.1, pluggy-0.13.1
rootdir: /babi
collected 507 items / 484 deselected / 23 selected

tests/features/resize_test.py .......... [ 43%]
tests/features/save_test.py . [ 47%]
tests/features/resize_test.py .......... [ 91%]
tests/features/save_test.py . [ 95%]
tests/features/suspend_test.py . [100%]

====================== 23 passed, 484 deselected in 6.95s ======================

tags: added: verification-done-focal
removed: verification-needed-focal
Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Thank you for verifying this fix! But looking at the verification in comment #4, I don't know how this correlates to the test case provided in the bug description. What are the tests that you have ran? Do they do the same as the reproducer script written in the Test Case section?

Usually we want verification to strictly follow the verification steps outlined in the bug definition. Would it be possible for you to run the reproducer script with the -proposed package?

tags: added: verification-needed-focal
removed: verification-done-focal
Revision history for this message
Anthony Sottile (asottile) wrote :

ah right I can see why that's not straightforward -- I was the reporter of the original bug on tmux and the reason I found the bug was due to a failing test case in the test suite of my text editor which uses tmux for integration tests

When I upgraded to 20.04 I noticed the same failures and reported this bug, and only after upgrading to the proposed version are those tests fixed

the original reproduction in the tmux bug was boiled down from a testcase in `resize_test.py`

Revision history for this message
Anthony Sottile (asottile) wrote :

ok! I've gone through and run the verification now -- looks good!

tags: added: verification-done verification-done-focal
removed: verification-needed verification-needed-focal
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package tmux - 3.0a-2ubuntu0.1

---------------
tmux (3.0a-2ubuntu0.1) focal; urgency=medium

  * Fix "regression: splitting panes does not cause a resize in
    backgrounded tmux" (LP: #1875109)
    - d/p/limit-lazy-resize-to-panes-in-attached-sessions-only.patch:
      New patch to limit the "lazy resize" to panes in attached sessions
      only. The panes in unattached sessions are resized immediately.

 -- Sergio Durigan Junior <email address hidden> Wed, 20 May 2020 07:53:46 -0400

Changed in tmux (Ubuntu Focal):
status: Fix Committed → Fix Released
Revision history for this message
Brian Murray (brian-murray) wrote : Update Released

The verification of the Stable Release Update for tmux has completed successfully and the package is now being released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers