On Mon, May 25, 2026 at 10:15:16AM +0800, Liam Huang wrote: > Hi, > > I've found a regression in ncurses 6.6 (patchdate 20251230) where > setupterm() fails on valid Linux pseudo-terminals, causing tmux's > tty_init() to fail and "open terminal failed: not a terminal" on attach.
This sounds like a bug which was reported in tmux without providing a way to reproduce it - https://lists.gnu.org/archive/html/bug-ncurses/2026-02/msg00025.html > The issue does NOT occur with ncurses 6.5 (patchdate 20240427) or > the Ubuntu system ncurses 6.4. This isn't the Ubuntu bug-reporting system. Since Ubuntu only mirrors ncurses updates from Debian, the place to report Ubuntu issues is in Debian. > > ENVIRONMENT > > OS: Ubuntu 24.04.4 LTS > Kernel: 6.8.0-107-generic x86_64 > tmux: 3.6b (Homebrew) Homebrew isn't Ubuntu - it's MacOS. > ncurses: 6.6.20251230 (Homebrew, wide-char build) > 6.5.20240427 (built from source, same configure flags) > 6.4+20240113 (Ubuntu system /lib/x86_64-linux-gnu) That's 3 versions of ncurses, one self-built, and (Homebrew isn't far from that, either). If you're going to do all of that, you should be able to configure ncurses for traces and provide that information. > REPRODUCTION > > # Using tmux 3.6b linked against ncurses 6.6: > $ tmux new -d -s test > $ tmux attach -t test > open terminal failed: not a terminal > > This happens in: > - Interactive SSH sessions (ssh user@host, then tmux a) > - VS Code Remote integrated terminal > - PTYs created by script(1) > > The ONLY working case is ssh -t host "tmux a -t test" (forced PTY > with terminal size forwarding from the SSH client). > > > ISOLATION > > Same tmux 3.6b binary, different ncurses library at runtime: > > | ncurses | method | result | > |-------------------|-------------------------------------|---------| > | 6.6.20251230 | default brew linkage | FAIL | > | 6.5.20240427 | LD_LIBRARY_PATH=.../ncurses-6.5/lib | OK | > | 6.4 (system) | LD_LIBRARY_PATH=/lib/x86_64-linux-gnu | OK | > > Commands to reproduce the isolation test: > > # FAIL with 6.6 > script -qc 'tmux -S /tmp/t66 new -d -s x && \ > tmux -S /tmp/t66 a -t x' /dev/null > > # OK with 6.5 > script -qc 'LD_LIBRARY_PATH=/path/to/ncurses-6.5/lib \ > tmux -S /tmp/t65 new -d -s x && \ > LD_LIBRARY_PATH=/path/to/ncurses-6.5/lib \ > tmux -S /tmp/t65 a -t x' /dev/null > > > MECHANISM > > tmux's server receives the client's PTY fd via SCM_RIGHTS, then > calls tty_init() -> setupterm(). With ncurses 6.6, setupterm() > apparently rejects the terminal, causing tty_init() to return -1. "apparently" can be used with lots of supporting data (actual system calls used, along with their results). > This leaves the CLIENT_TERMINAL flag unset, and server_client_open() > returns "not a terminal". > > strace shows the PTY is valid — TCGETS succeeds, the fd resolves > to /dev/pts/N, and permissions are correct (crw--w---- owner:tty). I don't see a trace (and in any case, this report deals with a large system, in which things can be misconfigured) > The tmux source code for this path is identical between 3.4 and > 3.6b, confirming the behavioral change is in ncurses, not tmux. > > > BUILD FLAGS (both 6.5 and 6.6 built with): > > ./configure --prefix=... --with-shared --with-widec \ > --enable-pc-files --enable-sigwinch --enable-ext-colors \ > --without-debug --without-ada > > > I haven't bisected the exact ncurses patch between 6.5 and 6.6 yet. > Happy to test patches or provide additional traces if helpful. That's about 18 months of changes :-) -- Thomas E. Dickey <[email protected]> https://invisible-island.net
signature.asc
Description: PGP signature
