From dda7605028915084ac9c50053cdae90669ba899b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Ferr=C3=A3o?= <2031761+viniciusferrao@users.noreply.github.com> Date: Wed, 22 Jul 2026 21:00:37 -0300 Subject: [PATCH] fix(tcons): make tcons work with modern tmux tcons opens an rcons console per node in a tiled tmux session. On tmux 3.x (shipped by all currently supported platforms) it no longer works: * The session was named "tcons.$$". Modern tmux treats "." as the session:window.pane target separator, so "tmux attach -t tcons.$$" is parsed as session "tcons", pane "$$" and fails with "can't find session"/"can't find pane" -- tcons cannot attach to the session it just created. Rename it to "tcons_$$". * The per-node "tmux select-pane", "tmux split" and "tmux select-layout" commands had no target. When tcons is run from inside an existing tmux session (the common case) they act on the caller's current session instead of the detached tcons session, splitting the operator's own window. Target every command explicitly at the tcons session. * Move the pane-border-status option inside the loop so the console title is set on each pane as it is created. Validated on tmux next-3.4: the reworked script builds a 3-pane tiled session with no errors, whereas the previous version's dotted session name is unaddressable ("can't find pane"). Recovered from the unmerged lenovobuild branch (originals 5107b6ba1, cefefa7d1, 6c72a2707, e040d24bb). Co-authored-by: Jarrod Johnson <10814490+jjohnson42@users.noreply.github.com> --- xCAT-client/bin/tcons | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/xCAT-client/bin/tcons b/xCAT-client/bin/tcons index 2cf994f9b..b91704e1d 100755 --- a/xCAT-client/bin/tcons +++ b/xCAT-client/bin/tcons @@ -5,14 +5,15 @@ for i in `nodels "$1"`; do if [ "$f" = 1 ]; then f=0 qdate=$((`date +%s`+5)) - tmux new-session -d -s tcons.$$ -x 800 -y 800 "rcons $i;if [ \`date +%s\` -lt $qdate ]; then echo Press enter to close; read qdate; fi" + tmux new-session -d -s tcons_$$ -x 800 -y 800 "rcons $i;if [ \`date +%s\` -lt $qdate ]; then echo Press enter to close; read qdate; fi" continue fi - tmux select-pane -t $p + tmux select-pane -t tcons_$$ + tmux set-option -t tcons_$$:$p pane-border-status top > /dev/null 2>&1 | cat > /dev/null p=$((p+1)) qdate=$((`date +%s`+5)) - tmux split -h "rcons $i;if [ \`date +%s\` -lt $qdate ]; then echo Press enter to close; read qdate; fi" - tmux select-layout tiled + tmux split -h -t tcons_$$ "rcons $i;if [ \`date +%s\` -lt $qdate ]; then echo Press enter to close; read qdate; fi" + tmux select-layout -t tcons_$$ tiled done tmux select-pane -t 0 -tmux attach -t tcons.$$ +tmux attach -t tcons_$$