Re: ncurses 6.6 regression: setupterm() rejects valid PTY, breaks tmux attach
Liam Huang <[email protected]> Wed, 27 May 2026 17:22:20 +0800
| Newsgroups | gmane.comp.lib.ncurses.bugs |
|---|---|
| Message-ID | <[email protected]> |
--Apple-Mail=_240FF796-E10E-462E-B6E4-4A6C745A5E54 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Hi Nicholas, Thank you for chiming in =E2=80=94 I certainly didn't expect to draw the attention of tmux's author on the ncurses mailing list! You're right, and I apologize for the noise. I should have read the 3.6 release notes more carefully before going down this rabbit hole. The note in https://github.com/tmux/tmux/issues/4699 describes exactly the symptom I was seeing. For what it's worth, the investigation did eventually converge on the same conclusion =E2=80=94 the imsg library protocol change between 3.5a = and 3.6b makes old servers unable to receive fds from new clients. I just took the scenic route getting there, and incorrectly blamed ncurses along the way. One thought: would it be feasible for the tmux client to detect a server version or protocol mismatch and print a more specific error message (e.g., "server was started by an older tmux version, please run 'tmux kill-server' and retry")? The current "open terminal failed: not a terminal" doesn't hint at the actual cause, which is probably why both I and the earlier 2026-02 reporter ended up looking in the wrong places. In any case, thank you for the clarification, and sorry again for the misdirected report. Best, Liam > 2026=E5=B9=B45=E6=9C=8827=E6=97=A5 17:15=EF=BC=8CNicholas Marriott = <[email protected]> =E5=86=99=E9=81=93=EF=BC=9A >=20 > This was already mentioned in the tmux 3.6 release notes, see the = second paragraph here: >=20 > https://github.com/tmux/tmux/issues/4699 >=20 >=20 >=20 >=20 >=20 > On Wed, 27 May 2026, 08:27 Liam Huang, <[email protected] = <mailto:[email protected]>> wrote: >> Hi Thomas, >>=20 >> Thank you for your reply and pointers. I'm writing back with a = correction: >> after further investigation, I've determined that this is NOT an = ncurses >> bug. I apologize for the noise. >>=20 >>=20 >> CORRECTION >>=20 >> The "open terminal failed: not a terminal" error is caused by a tmux >> client/server version mismatch after a Homebrew upgrade, not by = ncurses >> 6.6's setupterm(). ncurses is innocent here. >>=20 >>=20 >> WHAT WENT WRONG WITH MY ORIGINAL ANALYSIS >>=20 >> My isolation test used LD_LIBRARY_PATH to swap ncurses versions at >> runtime. I believed this showed ncurses 6.6 as the regression = boundary. >> However, the brew tmux binary has a hardcoded DT_RPATH (not = DT_RUNPATH) >> pointing to its ncurses directory. DT_RPATH takes priority over >> LD_LIBRARY_PATH, so all three test groups were actually running with >> ncurses 6.6 =E2=80=94 the test was invalid. >>=20 >> The real variable I failed to control was the tmux server version. = Before >> `brew upgrade`, an older tmux (3.5a) server was still running. After = the >> upgrade, the new 3.6b client connected to the old server, triggering = the >> failure. >>=20 >>=20 >> ACTUAL ROOT CAUSE >>=20 >> tmux 3.6b upgraded its bundled OpenBSD imsg IPC library. The struct >> imsg_hdr layout changed in an ABI-incompatible way: >>=20 >> Old (3.5a): type(u32) + len(u16) + flags(u16) + peerid(u32) + = pid(u32) >> New (3.6b): type(u32) + len(u32) + peerid(u32) + = pid(u32) >>=20 >> The old library marks "message carries an fd" with flags & = IMSGF_HASFD >> (bit 0 of the flags field). The new library uses len & 0x80000000 >> (bit 31 of the widened len field), with the flags field removed = entirely. >>=20 >> When the new client sends MSG_IDENTIFY_STDIN (carrying the terminal = fd), >> the old server misparses the header: it reads len=3D0x0010, = flags=3D0x8000, >> and since 0x8000 & IMSGF_HASFD(0x0001) =3D=3D 0, it never dequeues = the fd. >> The client's terminal fd is lost, isatty() fails on a stale fd, and = tmux >> reports "not a terminal". >>=20 >> I confirmed this with strace (ioctl(TCGETS) returns ENOTTY on the >> received fd) and ncurses trace (setupterm() is never called =E2=80=94 = the failure >> occurs before ncurses is involved). >>=20 >>=20 >> CLARIFICATIONS ON YOUR REPLY >>=20 >> A few small points, respectfully: >>=20 >> 1. "Homebrew isn't Ubuntu - it's MacOS" >>=20 >> Homebrew has officially supported Linux since 2019 (the former >> Linuxbrew project merged into mainline). It is widely used on = Linux >> servers and in CI environments. My setup =E2=80=94 Homebrew on = Ubuntu =E2=80=94 is a >> supported configuration, not an exotic one. >>=20 >> 2. "This isn't the Ubuntu bug-reporting system" >>=20 >> Understood. I was not reporting an Ubuntu/Debian packaging issue. = I was >> reporting what I believed to be a regression in ncurses 6.6 = itself, >> tested with a from-source build using the same configure flags. As = it >> turns out, the bug was not in ncurses at all, so this is moot. >>=20 >> 3. The 2026-02 report you referenced (bug-ncurses/2026-02/msg00025) >>=20 >> That earlier report may or may not be the same issue. If the = reporter >> was also hitting a tmux version mismatch after an upgrade, it = would >> explain why no reproducer was provided =E2=80=94 the problem = disappears once >> the old server is killed. It might be worth asking them whether = they >> had recently upgraded tmux. >>=20 >>=20 >> SUMMARY >>=20 >> - ncurses 6.6 setupterm() works correctly. I verified this with both = a >> minimal C reproducer (SCM_RIGHTS fd passing + setupterm()) and = ncurses >> trace output. >> - The bug is in tmux's cross-version compatibility (or lack thereof) >> after an imsg library ABI change. >> - I've updated the Homebrew issue (homebrew-core#284568) with the >> correction. >>=20 >> ONE QUESTION >>=20 >> Since the root cause is in tmux (the imsg library ABI change breaks >> cross-version client/server compatibility without bumping = PROTOCOL_VERSION), >> would you recommend I report this to the tmux project? If so, could = you >> suggest the appropriate channel =E2=80=94 is it the GitHub issue = tracker at >> https://github.com/tmux/tmux/issues, or the tmux-users mailing list? >>=20 >> Again, I apologize for the incorrect report and for taking your time. >> Thank you for maintaining ncurses. >>=20 >> Best regards, >> Liam >>=20 >>=20 >>> 2026=E5=B9=B45=E6=9C=8825=E6=97=A5 22:42=EF=BC=8CThomas Dickey = <[email protected] <mailto:[email protected]>> = =E5=86=99=E9=81=93=EF=BC=9A >>>=20 >>> On Mon, May 25, 2026 at 10:15:16AM +0800, Liam Huang wrote: >>>> Hi, >>>>=20 >>>> 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. >>>=20 >>> This sounds like a bug which was reported in tmux without providing = a >>> way to reproduce it -=20 >>>=20 >>> https://lists.gnu.org/archive/html/bug-ncurses/2026-02/msg00025.html >>>=20 >>>> The issue does NOT occur with ncurses 6.5 (patchdate 20240427) or >>>> the Ubuntu system ncurses 6.4. >>>=20 >>> 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. >>>=20 >>>>=20 >>>> ENVIRONMENT >>>>=20 >>>> OS: Ubuntu 24.04.4 LTS >>>> Kernel: 6.8.0-107-generic x86_64 >>>> tmux: 3.6b (Homebrew) >>>=20 >>> Homebrew isn't Ubuntu - it's MacOS. >>>=20 >>>> 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) >>>=20 >>> 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. >>>=20 >>>> REPRODUCTION >>>>=20 >>>> # Using tmux 3.6b linked against ncurses 6.6: >>>> $ tmux new -d -s test >>>> $ tmux attach -t test >>>> open terminal failed: not a terminal >>>>=20 >>>> This happens in: >>>> - Interactive SSH sessions (ssh user@host, then tmux a) >>>> - VS Code Remote integrated terminal >>>> - PTYs created by script(1) >>>>=20 >>>> The ONLY working case is ssh -t host "tmux a -t test" (forced PTY >>>> with terminal size forwarding from the SSH client). >>>>=20 >>>>=20 >>>> ISOLATION >>>>=20 >>>> Same tmux 3.6b binary, different ncurses library at runtime: >>>>=20 >>>> | ncurses | method | result = | >>>> = |-------------------|-------------------------------------|---------| >>>> | 6.6.20251230 | default brew linkage | FAIL = | >>>> | 6.5.20240427 | LD_LIBRARY_PATH=3D.../ncurses-6.5/lib | OK = | >>>> | 6.4 (system) | LD_LIBRARY_PATH=3D/lib/x86_64-linux-gnu | OK = | >>>>=20 >>>> Commands to reproduce the isolation test: >>>>=20 >>>> # FAIL with 6.6 >>>> script -qc 'tmux -S /tmp/t66 new -d -s x && \ >>>> tmux -S /tmp/t66 a -t x' /dev/null >>>>=20 >>>> # OK with 6.5 >>>> script -qc 'LD_LIBRARY_PATH=3D/path/to/ncurses-6.5/lib \ >>>> tmux -S /tmp/t65 new -d -s x && \ >>>> LD_LIBRARY_PATH=3D/path/to/ncurses-6.5/lib \ >>>> tmux -S /tmp/t65 a -t x' /dev/null >>>>=20 >>>>=20 >>>> MECHANISM >>>>=20 >>>> 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. >>>=20 >>> "apparently" can be used with lots of supporting data (actual >>> system calls used, along with their results). >>>=20 >>>> This leaves the CLIENT_TERMINAL flag unset, and = server_client_open() >>>> returns "not a terminal". >>>>=20 >>>> strace shows the PTY is valid =E2=80=94 TCGETS succeeds, the fd = resolves >>>> to /dev/pts/N, and permissions are correct (crw--w---- owner:tty). >>>=20 >>> I don't see a trace (and in any case, this report deals with a large = system, >>> in which things can be misconfigured) >>>=20 >>>> The tmux source code for this path is identical between 3.4 and >>>> 3.6b, confirming the behavioral change is in ncurses, not tmux. >>>>=20 >>>>=20 >>>> BUILD FLAGS (both 6.5 and 6.6 built with): >>>>=20 >>>> ./configure --prefix=3D... --with-shared --with-widec \ >>>> --enable-pc-files --enable-sigwinch --enable-ext-colors \ >>>> --without-debug --without-ada >>>>=20 >>>>=20 >>>> 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. >>>=20 >>> That's about 18 months of changes :-) >>>=20 >>> --=20 >>> Thomas E. Dickey <[email protected] = <mailto:[email protected]>> >>> https://invisible-island.net <https://invisible-island.net/> --Apple-Mail=_240FF796-E10E-462E-B6E4-4A6C745A5E54 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 <html aria-label=3D"message body"><head><meta http-equiv=3D"content-type" = content=3D"text/html; charset=3Dutf-8"></head><body = style=3D"overflow-wrap: break-word; -webkit-nbsp-mode: space; = line-break: after-white-space;"><div>Hi = Nicholas,</div><div><br></div><div>Thank you for chiming in =E2=80=94 I = certainly didn't expect to draw the</div><div>attention of tmux's author = on the ncurses mailing list!</div><div><br></div><div>You're right, and = I apologize for the noise. I should have read the</div><div>3.6 release = notes more carefully before going down this rabbit hole.</div><div>The = note in https://github.com/tmux/tmux/issues/4699 describes = exactly</div><div>the symptom I was seeing.</div><div><br></div><div>For = what it's worth, the investigation did eventually converge on = the</div><div>same conclusion =E2=80=94 the imsg library protocol change = between 3.5a and</div><div>3.6b makes old servers unable to receive fds = from new clients. I just</div><div>took the scenic route getting there, = and incorrectly blamed ncurses</div><div>along the = way.</div><div><br></div><div>One thought: would it be feasible for the = tmux client to detect a</div><div>server version or protocol mismatch = and print a more specific error</div><div>message (e.g., "server was = started by an older tmux version, please</div><div>run 'tmux = kill-server' and retry")? The current "open terminal = failed:</div><div>not a terminal" doesn't hint at the actual cause, = which is probably why</div><div>both I and the earlier 2026-02 reporter = ended up looking in the = wrong</div><div>places.</div><div><br></div><div>In any case, thank you = for the clarification, and sorry again for the</div><div>misdirected = report.</div><div><br></div><div>Best,</div><div>Liam</div><div><br></div>= <div><br><blockquote type=3D"cite"><div>2026=E5=B9=B45=E6=9C=8827=E6=97=A5= 17:15=EF=BC=8CNicholas Marriott <[email protected]> = =E5=86=99=E9=81=93=EF=BC=9A</div><br = class=3D"Apple-interchange-newline"><div><div dir=3D"auto"><div>This was = already mentioned in the tmux 3.6 release notes, see the second = paragraph here:</div><div dir=3D"auto"><br></div><div dir=3D"auto"><a = href=3D"https://github.com/tmux/tmux/issues/4699">https://github.com/tmux/= tmux/issues/4699</a></div><div dir=3D"auto"><br></div><div = dir=3D"auto"><br></div><div dir=3D"auto"><br></div><div = dir=3D"auto"><br><br><div class=3D"gmail_quote gmail_quote_container" = dir=3D"auto"><div dir=3D"ltr" class=3D"gmail_attr">On Wed, 27 May 2026, = 08:27 Liam Huang, <<a href=3D"mailto:[email protected]">[email protected]</a>> = wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px = 0px 0px 0.8ex;border-left:1px solid = rgb(204,204,204);padding-left:1ex"><div style=3D""><div>Hi = Thomas,</div><div><br></div><div>Thank you for your reply and pointers. = I'm writing back with a correction:</div><div>after further = investigation, I've determined that this is NOT an = ncurses</div><div>bug. I apologize for the = noise.</div><div><br></div><div><br></div><div>CORRECTION</div><div><br></= div><div>The "open terminal failed: not a terminal" error is caused by a = tmux</div><div>client/server version mismatch after a Homebrew upgrade, = not by ncurses</div><div>6.6's setupterm(). ncurses is innocent = here.</div><div><br></div><div><br></div><div>WHAT WENT WRONG WITH MY = ORIGINAL ANALYSIS</div><div><br></div><div>My isolation test used = LD_LIBRARY_PATH to swap ncurses versions at</div><div>runtime. I = believed this showed ncurses 6.6 as the regression = boundary.</div><div>However, the brew tmux binary has a hardcoded = DT_RPATH (not DT_RUNPATH)</div><div>pointing to its ncurses directory. = DT_RPATH takes priority over</div><div>LD_LIBRARY_PATH, so all three = test groups were actually running with</div><div>ncurses 6.6 =E2=80=94 = the test was invalid.</div><div><br></div><div>The real variable I = failed to control was the tmux server version. Before</div><div>`brew = upgrade`, an older tmux (3.5a) server was still running. After = the</div><div>upgrade, the new 3.6b client connected to the old server, = triggering = the</div><div>failure.</div><div><br></div><div><br></div><div>ACTUAL = ROOT CAUSE</div><div><br></div><div>tmux 3.6b upgraded its bundled = OpenBSD imsg IPC library. The struct</div><div>imsg_hdr layout changed = in an ABI-incompatible way:</div><div><br></div><div> Old (3.5a): = type(u32) + len(u16) + flags(u16) + peerid(u32) + = pid(u32)</div><div> New (3.6b): type(u32) + len(u32) = + peerid(u32) + = pid(u32)</div><div><br></div><div>The old library marks "message carries = an fd" with flags & IMSGF_HASFD</div><div>(bit 0 of the flags = field). The new library uses len & 0x80000000</div><div>(bit 31 of = the widened len field), with the flags field removed = entirely.</div><div><br></div><div>When the new client sends = MSG_IDENTIFY_STDIN (carrying the terminal fd),</div><div>the old server = misparses the header: it reads len=3D0x0010, flags=3D0x8000,</div><div>and= since 0x8000 & IMSGF_HASFD(0x0001) =3D=3D 0, it never dequeues the = fd.</div><div>The client's terminal fd is lost, isatty() fails on a = stale fd, and tmux</div><div>reports "not a = terminal".</div><div><br></div><div>I confirmed this with strace = (ioctl(TCGETS) returns ENOTTY on the</div><div>received fd) and ncurses = trace (setupterm() is never called =E2=80=94 the = failure</div><div>occurs before ncurses is = involved).</div><div><br></div><div><br></div><div>CLARIFICATIONS ON = YOUR REPLY</div><div><br></div><div>A few small points, = respectfully:</div><div><br></div><div>1. "Homebrew isn't Ubuntu - it's = MacOS"</div><div><br></div><div> Homebrew has officially = supported Linux since 2019 (the former</div><div> Linuxbrew = project merged into mainline). It is widely used on = Linux</div><div> servers and in CI environments. My setup = =E2=80=94 Homebrew on Ubuntu =E2=80=94 is a</div><div> = supported configuration, not an exotic = one.</div><div><br></div><div>2. "This isn't the Ubuntu bug-reporting = system"</div><div><br></div><div> Understood. I was not = reporting an Ubuntu/Debian packaging issue. I was</div><div> = reporting what I believed to be a regression in ncurses 6.6 = itself,</div><div> tested with a from-source build using the = same configure flags. As it</div><div> turns out, the bug = was not in ncurses at all, so this is moot.</div><div><br></div><div>3. = The 2026-02 report you referenced = (bug-ncurses/2026-02/msg00025)</div><div><br></div><div> = That earlier report may or may not be the same issue. If the = reporter</div><div> was also hitting a tmux version mismatch = after an upgrade, it would</div><div> explain why no = reproducer was provided =E2=80=94 the problem disappears = once</div><div> the old server is killed. It might be worth = asking them whether they</div><div> had recently upgraded = tmux.</div><div><br></div><div><br></div><div>SUMMARY</div><div><br></div>= <div>- ncurses 6.6 setupterm() works correctly. I verified this with = both a</div><div> minimal C reproducer (SCM_RIGHTS fd passing + = setupterm()) and ncurses</div><div> trace output.</div><div>- The = bug is in tmux's cross-version compatibility (or lack = thereof)</div><div> after an imsg library ABI change.</div><div>- = I've updated the Homebrew issue (homebrew-core#284568) with = the</div><div> correction.</div><div><br></div><div>ONE = QUESTION</div><div><br></div><div>Since the root cause is in tmux (the = imsg library ABI change breaks</div><div>cross-version client/server = compatibility without bumping PROTOCOL_VERSION),</div><div>would you = recommend I report this to the tmux project? If so, could = you</div><div>suggest the appropriate channel =E2=80=94 is it the GitHub = issue tracker at</div><div><a href=3D"https://github.com/tmux/tmux/issues"= target=3D"_blank" = rel=3D"noreferrer">https://github.com/tmux/tmux/issues</a>, or the = tmux-users mailing list?</div><div><br></div><div>Again, I apologize for = the incorrect report and for taking your time.</div><div>Thank you for = maintaining ncurses.</div><div><br></div><div>Best = regards,</div><div>Liam</div><div><br></div><div><br><blockquote = type=3D"cite"><div>2026=E5=B9=B45=E6=9C=8825=E6=97=A5 22:42=EF=BC=8CThomas= Dickey <<a href=3D"mailto:[email protected]" = target=3D"_blank" rel=3D"noreferrer">[email protected]</a>> = =E5=86=99=E9=81=93=EF=BC=9A</div><br><div><span = style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-varia= nt-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-d= ecoration:none;float:none;display:inline">On Mon, May 25, 2026 at = 10:15:16AM +0800, Liam Huang wrote:</span><br = style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-varia= nt-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-d= ecoration-line:none;text-decoration-style:solid"><blockquote type=3D"cite"= = style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-varia= nt-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-d= ecoration-line:none;text-decoration-style:solid">Hi,<br><br>I've found a = regression in ncurses 6.6 (patchdate 20251230) where<br>setupterm() = fails on valid Linux pseudo-terminals, causing tmux's<br>tty_init() to = fail and "open terminal failed: not a terminal" on = attach.<br></blockquote><br = style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-varia= nt-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-d= ecoration-line:none;text-decoration-style:solid"><span = style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-varia= nt-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-d= ecoration:none;float:none;display:inline">This sounds like a bug which = was reported in tmux without providing a</span><br = style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-varia= nt-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-d= ecoration-line:none;text-decoration-style:solid"><span = style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-varia= nt-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-d= ecoration:none;float:none;display:inline">way to reproduce it = -<span> </span></span><br = style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-varia= nt-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-d= ecoration-line:none;text-decoration-style:solid"><br = style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-varia= nt-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-d= ecoration-line:none;text-decoration-style:solid"><a = href=3D"https://lists.gnu.org/archive/html/bug-ncurses/2026-02/msg00025.ht= ml" = style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-varia= nt-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px" = target=3D"_blank" = rel=3D"noreferrer">https://lists.gnu.org/archive/html/bug-ncurses/2026-02/= msg00025.html</a><br = style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-varia= nt-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-d= ecoration-line:none;text-decoration-style:solid"><br = style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-varia= nt-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-d= ecoration-line:none;text-decoration-style:solid"><blockquote type=3D"cite"= = style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-varia= nt-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-d= ecoration-line:none;text-decoration-style:solid">The issue does NOT = occur with ncurses 6.5 (patchdate 20240427) or<br>the Ubuntu system = ncurses 6.4.<br></blockquote><br = style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-varia= nt-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-d= ecoration-line:none;text-decoration-style:solid"><span = style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-varia= nt-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-d= ecoration:none;float:none;display:inline">This isn't the Ubuntu = bug-reporting system. Since Ubuntu only</span><br = style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-varia= nt-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-d= ecoration-line:none;text-decoration-style:solid"><span = style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-varia= nt-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-d= ecoration:none;float:none;display:inline">mirrors ncurses updates from = Debian, the place to report Ubuntu issues</span><br = style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-varia= nt-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-d= ecoration-line:none;text-decoration-style:solid"><span = style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-varia= nt-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-d= ecoration:none;float:none;display:inline">is in Debian.</span><br = style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-varia= nt-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-d= ecoration-line:none;text-decoration-style:solid"><br = style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-varia= nt-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-d= ecoration-line:none;text-decoration-style:solid"><blockquote type=3D"cite"= = style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-varia= nt-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-d= ecoration-line:none;text-decoration-style:solid"><br>ENVIRONMENT<br><br>&n= bsp;OS: Ubuntu 24.04.4 = LTS<br> Kernel: 6.8.0-107-generic x86_64<br> tmux: = 3.6b (Homebrew)<br></blockquote><br = style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-varia= nt-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-d= ecoration-line:none;text-decoration-style:solid"><span = style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-varia= nt-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-d= ecoration:none;float:none;display:inline">Homebrew isn't Ubuntu - it's = MacOS.</span><br = style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-varia= nt-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-d= ecoration-line:none;text-decoration-style:solid"><br = style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-varia= nt-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-d= ecoration-line:none;text-decoration-style:solid"><blockquote type=3D"cite"= = style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-varia= nt-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-d= ecoration-line:none;text-decoration-style:solid"> ncurses: = 6.6.20251230 (Homebrew, wide-char = build)<br> &nbs= p;6.5.20240427 (built from source, same configure = flags)<br> &nbs= p;6.4+20240113 (Ubuntu system /lib/x86_64-linux-gnu)<br></blockquote><br = style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-varia= nt-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-d= ecoration-line:none;text-decoration-style:solid"><span = style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-varia= nt-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-d= ecoration:none;float:none;display:inline">That's 3 versions of ncurses, = one self-built, and (Homebrew isn't</span><br = style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-varia= nt-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-d= ecoration-line:none;text-decoration-style:solid"><span = style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-varia= nt-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-d= ecoration:none;float:none;display:inline">far from that, either). = If you're going to do all of that, you</span><br = style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-varia= nt-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-d= ecoration-line:none;text-decoration-style:solid"><span = style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-varia= nt-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-d= ecoration:none;float:none;display:inline">should be able to configure = ncurses for traces and provide that information.</span><br = style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-varia= nt-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-d= ecoration-line:none;text-decoration-style:solid"><br = style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-varia= nt-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-d= ecoration-line:none;text-decoration-style:solid"><blockquote type=3D"cite"= = style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-varia= nt-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-d= ecoration-line:none;text-decoration-style:solid">REPRODUCTION<br><br> = ;# Using tmux 3.6b linked against ncurses 6.6:<br> $ tmux new -d -s = test<br> $ tmux attach -t test<br> open terminal failed: not a = terminal<br><br> This happens in:<br> - Interactive SSH = sessions (ssh user@host, then tmux a)<br> - VS Code Remote = integrated terminal<br> - PTYs created by = script(1)<br><br> The ONLY working case is ssh -t host "tmux a -t = test" (forced PTY<br> with terminal size forwarding from the SSH = client).<br><br><br>ISOLATION<br><br> Same tmux 3.6b binary, = different ncurses library at runtime:<br><br> | ncurses = | method = &n= bsp; &nbs= p; | result = |<br> |-------------------|------------------------------------= -|---------|<br> | 6.6.20251230 | = default brew linkage = &n= bsp; | FAIL |<br> | 6.5.20240427 = | LD_LIBRARY_PATH=3D.../ncurses-6.5/lib | = OK |<br> | 6.4 (system) = | LD_LIBRARY_PATH=3D/lib/x86_64-linux-gnu = | OK |<br><br> Commands to reproduce the = isolation test:<br><br> # FAIL with = 6.6<br> script -qc 'tmux -S /tmp/t66 new -d -s x = && = \<br> &nb= sp; tmux -S /tmp/t66 a -t x' = /dev/null<br><br> # OK with = 6.5<br> script -qc = 'LD_LIBRARY_PATH=3D/path/to/ncurses-6.5/lib = \<br> &nb= sp; tmux -S /tmp/t65 new -d -s x && = \<br> &nb= sp; LD_LIBRARY_PATH=3D/path/to/ncurses-6.5/lib = \<br> &nb= sp; tmux -S /tmp/t65 a -t x' = /dev/null<br><br><br>MECHANISM<br><br> tmux's server receives the = client's PTY fd via SCM_RIGHTS, then<br> calls tty_init() -> = setupterm(). With ncurses 6.6, setupterm()<br> apparently rejects = the terminal, causing tty_init() to return -1.<br></blockquote><br = style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-varia= nt-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-d= ecoration-line:none;text-decoration-style:solid"><span = style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-varia= nt-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-d= ecoration:none;float:none;display:inline">"apparently" can be used with = lots of supporting data (actual</span><br = style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-varia= nt-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-d= ecoration-line:none;text-decoration-style:solid"><span = style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-varia= nt-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-d= ecoration:none;float:none;display:inline">system calls used, along with = their results).</span><br = style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-varia= nt-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-d= ecoration-line:none;text-decoration-style:solid"><br = style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-varia= nt-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-d= ecoration-line:none;text-decoration-style:solid"><blockquote type=3D"cite"= = style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-varia= nt-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-d= ecoration-line:none;text-decoration-style:solid"> This leaves the = CLIENT_TERMINAL flag unset, and server_client_open()<br> returns = "not a terminal".<br><br> strace shows the PTY is valid =E2=80=94 = TCGETS succeeds, the fd resolves<br> to /dev/pts/N, and permissions = are correct (crw--w---- owner:tty).<br></blockquote><br = style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-varia= nt-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-d= ecoration-line:none;text-decoration-style:solid"><span = style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-varia= nt-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-d= ecoration:none;float:none;display:inline">I don't see a trace (and in = any case, this report deals with a large system,</span><br = style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-varia= nt-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-d= ecoration-line:none;text-decoration-style:solid"><span = style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-varia= nt-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-d= ecoration:none;float:none;display:inline">in which things can be = misconfigured)</span><br = style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-varia= nt-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-d= ecoration-line:none;text-decoration-style:solid"><br = style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-varia= nt-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-d= ecoration-line:none;text-decoration-style:solid"><blockquote type=3D"cite"= = style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-varia= nt-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-d= ecoration-line:none;text-decoration-style:solid"> The tmux source = code for this path is identical between 3.4 and<br> 3.6b, = confirming the behavioral change is in ncurses, not = tmux.<br><br><br>BUILD FLAGS (both 6.5 and 6.6 built = with):<br><br> ./configure --prefix=3D... --with-shared = --with-widec \<br> --enable-pc-files --enable-sigwinch = --enable-ext-colors \<br> --without-debug = --without-ada<br><br><br>I haven't bisected the exact ncurses patch = between 6.5 and 6.6 yet.<br>Happy to test patches or provide additional = traces if helpful.<br></blockquote><br = style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-varia= nt-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-d= ecoration-line:none;text-decoration-style:solid"><span = style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-varia= nt-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-d= ecoration:none;float:none;display:inline">That's about 18 months of = changes :-)</span><br = style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-varia= nt-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-d= ecoration-line:none;text-decoration-style:solid"><br = style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-varia= nt-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-d= ecoration-line:none;text-decoration-style:solid"><span = style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-varia= nt-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-d= ecoration:none;float:none;display:inline">--<span> </span></span><br = style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-varia= nt-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-d= ecoration-line:none;text-decoration-style:solid"><span = style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-varia= nt-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-d= ecoration:none;float:none;display:inline">Thomas E. Dickey <</span><a = href=3D"mailto:[email protected]" = style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-varia= nt-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px" = target=3D"_blank" rel=3D"noreferrer">[email protected]</a><span = style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-varia= nt-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-d= ecoration:none;float:none;display:inline">></span><br = style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-varia= nt-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-d= ecoration-line:none;text-decoration-style:solid"><a = href=3D"https://invisible-island.net/" = style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-varia= nt-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px" = target=3D"_blank" = rel=3D"noreferrer">https://invisible-island.net</a></div></blockquote></di= v><br></div></blockquote></div></div></div> </div></blockquote></div><br></body></html>= --Apple-Mail=_240FF796-E10E-462E-B6E4-4A6C745A5E54--