Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automated testing fails: tmux 3.2a + bash 3.2 #174

Closed
greymd opened this issue Jan 31, 2023 · 9 comments
Closed

Automated testing fails: tmux 3.2a + bash 3.2 #174

greymd opened this issue Jan 31, 2023 · 9 comments
Labels

Comments

@greymd
Copy link
Owner

greymd commented Jan 31, 2023

https://github.com/greymd/tmux-xpanes/actions/runs/4049321949/jobs/6965662443
case 72 and 73 are failed continuously.

@greymd
Copy link
Owner Author

greymd commented Jan 31, 2023

Reproduced on bash:3.2 container.

bash-3.2# tmux -V
tmux 3.2a
bash-3.2# bash -version
GNU bash, version 3.2.57(1)-release (x86_64-pc-linux-musl)
Copyright (C) 2007 Free Software Foundation, Inc.
bash-3.2# ./bin/xpanes -R 4 -t -s -lev -S ./session --stay AAAA BBBB CCCC DDDD EEEE FFFF GGGG HHHH IIII
xpanes:Info: Columns/rows option (-C, --cols, -R, --rows) and -l option are provided. Disable -l.
bash-3.2# tmux -S ./session ls
xpanes-23219: 2 windows (created Tue Jan 31 01:18:55 2023)
bash-3.2# tmux -S ./session attach

=> layout broken.

@greymd
Copy link
Owner Author

greymd commented Jan 31, 2023

I've tried bashdb, but it cannot jump functions

Debug with Bash debugger

bash-3.2# bashdb --version
Bourne-Again Shell Debugger, release bash-3.1-0.09
Copyright 2002, 2003, 2004, 2006, 2007 Rocky Bernstein
This is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.

There is absolutely no warranty for BASHDB.  Type "show warranty" for details.
bash-3.2# bashdb --debugger -- ./bin/xpanes -R 4 -t -s -lev -S ./session --stay AAAA BBBB CCCC DDDD EEEE FFFF GGGG HHHH IIII
Bourne-Again Shell Debugger, release bash-3.1-0.09
Copyright 2002, 2003, 2004, 2006, 2007 Rocky Bernstein
This is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.

Reading /tmux-xpanes/bin/xpanes: [=====================================>   ]  92%
done.
(/tmux-xpanes/bin/xpanes:2):
2:	readonly XP_SHELL="/usr/bin/env bash"
bashdb<0> b 1480
Breakpoint 1 set in file /tmux-xpanes/bin/xpanes, line 1480.
bashdb<1> c
bashdb:Info: Columns/rows option (-C, --cols, -R, --rows) and -l option are provided. Disable -l.
Breakpoint 1 hit (1 times).
(/tmux-xpanes/bin/xpanes:1480):
1480:	xpns_clean_session || true
bashdb<2> n
(/tmux-xpanes/bin/xpanes:1483):
1483:	${TMUX_XPANES_EXEC} -S "${XP_SOCKET_PATH}" new-session \
bashdb<3> list
1483:==>${TMUX_XPANES_EXEC} -S "${XP_SOCKET_PATH}" new-session \
1484:   -s "${XP_SESSION_NAME}" \
1485:   -n "${XP_TMP_WIN_NAME}" \
1486:   -d "${XP_ABS_THIS_FILE_NAME} ${_opts4args} ${_args4args}"
1487:
1488:   # Avoid attaching (for unit testing).
1489:   if [[ ${XP_OPT_ATTACH} -eq 1 ]]; then
1490:   if ! ${TMUX_XPANES_EXEC} -S "${XP_SOCKET_PATH}" attach-session -t "${XP_SESSION_NAME}" &&
1491:   [[ ${XP_IS_PIPE_MODE} -eq 1    ]]; then
1492:   ## In recovery case, overwrite trap to keep socket file
bashdb<4> !! echo $XP_ABS_THIS_FILE_NAME
/tmux-xpanes/bin/bashdb
bashdb<5> next
(/tmux-xpanes/bin/xpanes:1489):
1489:	if [[ ${XP_OPT_ATTACH} -eq 1 ]]; then
bashdb<6> !! echo $XP_ABS_THIS_FILE_NAME
/tmux-xpanes/bin/bashdb
bashdb<7> !! echo ${_opts4args} ${_args4args}
'-R' '4' '-t' '-s' '-l' 'ev' '-S' './session' '--stay' '-c' 'echo {} ' '--' 'AAAA' 'BBBB' 'CCCC' 'DDDD' 'EEEE' 'FFFF' 'GGGG' 'HHHH' 'IIII'

=> It seems that, --stay option is taken over to new session and it causes the broken layout ?

@greymd greymd added the bug label Jan 31, 2023
@greymd
Copy link
Owner Author

greymd commented Jan 31, 2023

Environment: docker container bash:3.2

bash-3.2# stty size
81 179
export TMUX_XPANES_EXEC=tmux3.2a
./bin/xpanes -S ./session -R 4 -t -lev --stay AAAA BBBB CCCC DDDD EEEE FFFF GGGG HHHH IIII
tmux -S ./session  attach

=> reproduced
Screenshot 2023-01-31 at 02 57 44

export TMUX_XPANES_EXEC=tmux3.1c
./bin/xpanes -S ./session -R 4 -t -lev --stay AAAA BBBB CCCC DDDD EEEE FFFF GGGG HHHH IIII
tmux -S ./session  attach

=> NOT reproduced
Screenshot 2023-01-31 at 02 58 16

@greymd
Copy link
Owner Author

greymd commented Jan 31, 2023

Next action:
Try other tmux versions and check if it is caused by the difference of tmux.

Here is the difference between set -x result of for each versions.
It seems that either tmux version underestimates the window size compare to the actual size.
It may cause the broken layout.

-++ tmux3.1c display-message -p '#{window_height} #{window_width}'
+++ tmux3.2a display-message -p '#{window_height} #{window_width}'
 + [[ -n '' ]]
-++ xpns_check_cell_size 9 '' 4 24 80 0
+++ xpns_check_cell_size 9 '' 4 80 179 0
 ++ local _cell_num=9

When the session is being un-attached with --stay option, reported window size got varied.

@greymd greymd changed the title automatic test fails: tmux 3.2a + bash 3.2 Atumated testing fails: tmux 3.2a + bash 3.2 Jan 31, 2023
@greymd
Copy link
Owner Author

greymd commented Jan 31, 2023

$ stty size
81 179
$ tmux3.1c -S ./session new-session -s test-1 -n win-1 -d /bin/sh
$ tmux3.1c -S ./session display-message -p '#{window_height} #{window_width}'
24 80
$ tmux3.1c -S ./session kill-session
$ tmux3.2a -S ./session new-session -s test-1 -n win-1 -d /bin/sh
$ tmux3.2a -S ./session display-message -p '#{window_height} #{window_width}'
80 179
$ tmux3.2a -S ./session kill-session

@greymd
Copy link
Owner Author

greymd commented Jan 31, 2023

Prerequisite

$ docker run -it bash:3.2
# apk add make curl gcc musl-dev libevent-dev ncurses-dev perl git util-linux bsd-compat-headers
# for v in 3.0a 3.1 3.1b 3.1c 3.2 3.2a 3.3 3.3a; do
  cd /tmp
  curl -L "https://github.com/tmux/tmux/releases/download/${v}/tmux-${v}.tar.gz" | tar zxv
  cd tmux-${v}
  ./configure
  make
  cp ./tmux /usr/bin/tmux-$v
done

Test

#!/bin/sh
stty size
for v in 3.0a 3.1 3.1b 3.1c 3.2 3.2a 3.3 3.3a; do
  cd /tmp
  /usr/bin/tmux-$v -S ./session new-session -s test-1 -n win-1 -d /bin/sh
  /usr/bin/tmux-$v -S ./session display-message -p "tmux $v: #{window_height} #{window_width}"
  /usr/bin/tmux-$v -S ./session kill-session
done

Result

bash-3.2# bash test.sh
81 179
tmux 3.0a: 24 80
tmux 3.1: 24 80
tmux 3.1b: 24 80
tmux 3.1c: 24 80
tmux 3.2: 24 80
tmux 3.2a: 80 179
tmux 3.3: 24 80
tmux 3.3a: 24 80

tmux 3.2a has something wrong in calculating process of winow size.

@greymd
Copy link
Owner Author

greymd commented Jan 31, 2023

Checking tmux/tmux change log.
As far as I checked, I couldn't find any issues related to this behavior.
However, checking logs in git, it seems there are several fix in tmux side.

$ git log --pretty=format:"%h%d%n%s %B%n===" | awk 'BEGIN{tag="latest"}/tag:/{tag=$NF}{print tag,$0}'
︙

3.3) 2df7bc14
3.3) Capture up to used size not available size for each line.
3.3)
︙
3.3) 921be619
3.3) Adjust size given to resize-pane for pane status line, GitHub issue
3.3) 3050.

The issue was resolved in 3.3 , thanks to above changes, I guess.

@greymd
Copy link
Owner Author

greymd commented Jan 31, 2023

Update known issue

https://github.com/greymd/tmux-xpanes/wiki/Known-Bugs

tmux 3.2a may report different window size under specific condition, see #174

@greymd greymd changed the title Atumated testing fails: tmux 3.2a + bash 3.2 Automated testing fails: tmux 3.2a + bash 3.2 Jan 31, 2023
greymd added a commit that referenced this issue Jan 31, 2023
See github issue #174 and 'Known-Bugs' page in wiki
@greymd
Copy link
Owner Author

greymd commented Jan 31, 2023

tmux 3.3a was removed from automated testing. closed.

@greymd greymd closed this as completed Jan 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant