Re: ncurses 6.6 regression: setupterm() rejects valid PTY, breaks tmux attach
"Johann 'Myrkraverk' Oskarsson" <[email protected]> Wed, 27 May 2026 17:27:17 +0800
| Newsgroups | gmane.comp.lib.ncurses.bugs |
|---|---|
| Message-ID | <CAA_SOw9=P75iQiiPiKYAyS4woYH6f=VGH63WT3=Nh_sAN2PPOw@mail.gmail.com> |
--00000000000073480d0652c93846 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Dear Liam, You forgot to CC Ethan. For further clarification, these are old bug reports of mine, or so it looks like, rewritten by an AI system. Please excuse this new bullshit. We are in a Mission Impossible movie. Johann I'm not from the internet, I just work there. On Wed, May 27, 2026, 5:23=E2=80=AFPM Liam Huang <[email protected]> wrote: > 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 a= nd > 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 <nicho= [email protected]> =E5=86=99=E9=81=93=EF=BC=9A > > This was already mentioned in the tmux 3.6 release notes, see the second > paragraph here: > > https://github.com/tmux/tmux/issues/4699 > > > > > > On Wed, 27 May 2026, 08:27 Liam Huang, <[email protected]> wrote: > >> Hi Thomas, >> >> Thank you for your reply and pointers. I'm writing back with a correctio= n: >> after further investigation, I've determined that this is NOT an ncurses >> bug. I apologize for the noise. >> >> >> CORRECTION >> >> 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. >> >> >> WHAT WENT WRONG WITH MY ORIGINAL ANALYSIS >> >> 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. >> >> The real variable I failed to control was the tmux server version. Befor= e >> `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. >> >> >> ACTUAL ROOT CAUSE >> >> tmux 3.6b upgraded its bundled OpenBSD imsg IPC library. The struct >> imsg_hdr layout changed in an ABI-incompatible way: >> >> Old (3.5a): type(u32) + len(u16) + flags(u16) + peerid(u32) + pid(u32) >> New (3.6b): type(u32) + len(u32) + peerid(u32) + pid(u32) >> >> 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= . >> >> When the new client sends MSG_IDENTIFY_STDIN (carrying the terminal fd), >> the old server misparses the header: it reads len=3D0x0010, flags=3D0x80= 00, >> and since 0x8000 & IMSGF_HASFD(0x0001) =3D=3D 0, it never dequeues the f= d. >> The client's terminal fd is lost, isatty() fails on a stale fd, and tmux >> reports "not a terminal". >> >> I confirmed this with strace (ioctl(TCGETS) returns ENOTTY on the >> received fd) and ncurses trace (setupterm() is never called =E2=80=94 th= e failure >> occurs before ncurses is involved). >> >> >> CLARIFICATIONS ON YOUR REPLY >> >> A few small points, respectfully: >> >> 1. "Homebrew isn't Ubuntu - it's MacOS" >> >> 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. >> >> 2. "This isn't the Ubuntu bug-reporting system" >> >> Understood. I was not reporting an Ubuntu/Debian packaging issue. I w= as >> 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. >> >> 3. The 2026-02 report you referenced (bug-ncurses/2026-02/msg00025) >> >> 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 disappea= rs once >> the old server is killed. It might be worth asking them whether they >> had recently upgraded tmux. >> >> >> SUMMARY >> >> - 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. >> >> ONE QUESTION >> >> 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? >> >> Again, I apologize for the incorrect report and for taking your time. >> Thank you for maintaining ncurses. >> >> Best regards, >> Liam >> >> >> 2026=E5=B9=B45=E6=9C=8825=E6=97=A5 22:42=EF=BC=8CThomas Dickey <dickey@i= nvisible-island.net> =E5=86=99=E9=81=93=EF=BC=9A >> >> 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=3D.../ncurses-6.5/lib | OK | >> | 6.4 (system) | LD_LIBRARY_PATH=3D/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=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 >> >> >> 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 =E2=80=94 TCGETS succeeds, the fd resolve= s >> 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=3D... --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 >> >> >> > --00000000000073480d0652c93846 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"auto"><div>Dear Liam,</div><div dir=3D"auto"><br></div><div dir= =3D"auto">You forgot to CC Ethan.=C2=A0 For further clarification, these ar= e old bug reports of mine, or so it looks like, rewritten by an AI system.= =C2=A0 Please excuse this new bullshit.=C2=A0 We are in a Mission Impossibl= e movie.</div><div dir=3D"auto"><br></div><div><br></div><div data-smartmai= l=3D"gmail_signature">Johann<br><br> =C2=A0I'm not from the internet, I= just work there.</div></div><br><div class=3D"gmail_quote gmail_quote_cont= ainer"><div dir=3D"ltr" class=3D"gmail_attr">On Wed, May 27, 2026, 5:23=E2= =80=AFPM Liam Huang <<a href=3D"mailto:[email protected]">[email protected]</a>> = wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8e= x;border-left:1px #ccc solid;padding-left:1ex"><div style=3D"line-break:aft= er-white-space"><div>Hi Nicholas,</div><div><br></div><div>Thank you for ch= iming in =E2=80=94 I certainly didn't expect to draw the</div><div>atte= ntion 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 t= he</div><div>3.6 release notes more carefully before going down this rabbit= hole.</div><div>The note in <a href=3D"https://github.com/tmux/tmux/issues= /4699" target=3D"_blank" rel=3D"noreferrer">https://github.com/tmux/tmux/is= sues/4699</a> describes exactly</div><div>the symptom I was seeing.</div><d= iv><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 proto= col change between 3.5a and</div><div>3.6b makes old servers unable to rece= ive fds from new clients. I just</div><div>took the scenic route getting th= ere, 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 e= rror</div><div>message (e.g., "server was started by an older tmux ver= sion, please</div><div>run 'tmux kill-server' and retry")? The= current "open terminal failed:</div><div>not a terminal" doesn&#= 39;t hint at the actual cause, which is probably why</div><div>both I and t= he 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 &= lt;<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><div dir=3D"auto"><div>This was already mentioned in the tmu= x 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" target=3D"_blank" rel=3D"noreferrer">https://github.com/tmux/tmux/iss= ues/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_qu= ote" 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]" target=3D"_blank" re= l=3D"noreferrer">[email protected]</a>> wrote:<br></div><blockquote class=3D"g= mail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204= ,204,204);padding-left:1ex"><div><div>Hi Thomas,</div><div><br></div><div>T= hank you for your reply and pointers. I'm writing back with a correctio= n:</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></di= v><div><br></div><div>CORRECTION</div><div><br></div><div>The "open te= rminal failed: not a terminal" error is caused by a tmux</div><div>cli= ent/server version mismatch after a Homebrew upgrade, not by ncurses</div><= div>6.6's setupterm(). ncurses is innocent here.</div><div><br></div><d= iv><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 a= t</div><div>runtime. I believed this showed ncurses 6.6 as the regression b= oundary.</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 act= ually running with</div><div>ncurses 6.6 =E2=80=94 the test was invalid.</d= iv><div><br></div><div>The real variable I failed to control was the tmux s= erver 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 connec= ted to the old server, triggering the</div><div>failure.</div><div><br></di= v><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_hd= r layout changed in an ABI-incompatible way:</div><div><br></div><div>=C2= =A0 Old (3.5a): type(u32) + len(u16) + flags(u16) + peerid(u32) + pid(u32)<= /div><div>=C2=A0 New (3.6b): type(u32) + len(u32) =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0+ peerid(u32) + pid(u32)</div><div><br></div><div>T= he old library marks "message carries an fd" with flags & IMS= GF_HASFD</div><div>(bit 0 of the flags field). The new library uses len &am= p; 0x80000000</div><div>(bit 31 of the widened len field), with the flags f= ield removed entirely.</div><div><br></div><div>When the new client sends M= SG_IDENTIFY_STDIN (carrying the terminal fd),</div><div>the old server misp= arses the header: it reads len=3D0x0010, flags=3D0x8000,</div><div>and sinc= e 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, a= nd 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></d= iv><div><br></div><div>CLARIFICATIONS ON YOUR REPLY</div><div><br></div><di= v>A few small points, respectfully:</div><div><br></div><div>1. "Homeb= rew isn't Ubuntu - it's MacOS"</div><div><br></div><div>=C2=A0= =C2=A0Homebrew has officially supported Linux since 2019 (the former</div>= <div>=C2=A0 =C2=A0Linuxbrew project merged into mainline). It is widely use= d on Linux</div><div>=C2=A0 =C2=A0servers and in CI environments. My setup = =E2=80=94 Homebrew on Ubuntu =E2=80=94 is a</div><div>=C2=A0 =C2=A0supporte= d configuration, not an exotic one.</div><div><br></div><div>2. "This = isn't the Ubuntu bug-reporting system"</div><div><br></div><div>= =C2=A0 =C2=A0Understood. I was not reporting an Ubuntu/Debian packaging iss= ue. I was</div><div>=C2=A0 =C2=A0reporting what I believed to be a regressi= on in ncurses 6.6 itself,</div><div>=C2=A0 =C2=A0tested with a from-source = build using the same configure flags. As it</div><div>=C2=A0 =C2=A0turns ou= t, 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)</d= iv><div><br></div><div>=C2=A0 =C2=A0That earlier report may or may not be t= he same issue. If the reporter</div><div>=C2=A0 =C2=A0was also hitting a tm= ux version mismatch after an upgrade, it would</div><div>=C2=A0 =C2=A0expla= in why no reproducer was provided =E2=80=94 the problem disappears once</di= v><div>=C2=A0 =C2=A0the old server is killed. It might be worth asking them= whether they</div><div>=C2=A0 =C2=A0had 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>=C2=A0= minimal C reproducer (SCM_RIGHTS fd passing + setupterm()) and ncurses</di= v><div>=C2=A0 trace output.</div><div>- The bug is in tmux's cross-vers= ion compatibility (or lack thereof)</div><div>=C2=A0 after an imsg library = ABI change.</div><div>- I've updated the Homebrew issue (homebrew-core#= 284568) with the</div><div>=C2=A0 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 compatibil= ity without bumping PROTOCOL_VERSION),</div><div>would you recommend I repo= rt this to the tmux project? If so, could you</div><div>suggest the appropr= iate channel =E2=80=94 is it the GitHub issue tracker at</div><div><a href= =3D"https://github.com/tmux/tmux/issues" rel=3D"noreferrer noreferrer" targ= et=3D"_blank">https://github.com/tmux/tmux/issues</a>, or the tmux-users ma= iling list?</div><div><br></div><div>Again, I apologize for the incorrect r= eport 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:dickey@invisible-island.= net" rel=3D"noreferrer noreferrer" target=3D"_blank">dickey@invisible-islan= d.net</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-variant-caps:normal= ;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;tex= t-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;f= loat:none;display:inline">On Mon, May 25, 2026 at 10:15:16AM +0800, Liam Hu= ang wrote:</span><br style=3D"font-family:Helvetica;font-size:12px;font-sty= le:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;te= xt-align:start;text-indent:0px;text-transform:none;white-space:normal;word-= spacing:0px;text-decoration-line:none;text-decoration-style:solid"><blockqu= ote type=3D"cite" style=3D"font-family:Helvetica;font-size:12px;font-style:= normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-= align:start;text-indent:0px;text-transform:none;white-space:normal;word-spa= cing:0px;text-decoration-line:none;text-decoration-style:solid">Hi,<br><br>= I've found a regression in ncurses 6.6 (patchdate 20251230) where<br>se= tupterm() fails on valid Linux pseudo-terminals, causing tmux's<br>tty_= init() to fail and "open terminal failed: not a terminal" on atta= ch.<br></blockquote><br style=3D"font-family:Helvetica;font-size:12px;font-= style:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal= ;text-align:start;text-indent:0px;text-transform:none;white-space:normal;wo= rd-spacing:0px;text-decoration-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-dec= oration:none;float:none;display:inline">This sounds like a bug which was re= ported in tmux without providing a</span><br style=3D"font-family:Helvetica= ;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:400;= letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;= white-space:normal;word-spacing:0px;text-decoration-line:none;text-decorati= on-style:solid"><span style=3D"font-family:Helvetica;font-size:12px;font-st= yle:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;t= ext-align:start;text-indent:0px;text-transform:none;white-space:normal;word= -spacing:0px;text-decoration:none;float:none;display:inline">way to reprodu= ce it -<span>=C2=A0</span></span><br style=3D"font-family:Helvetica;font-si= ze:12px;font-style:normal;font-variant-caps:normal;font-weight:400;letter-s= pacing:normal;text-align:start;text-indent:0px;text-transform:none;white-sp= ace:normal;word-spacing:0px;text-decoration-line:none;text-decoration-style= :solid"><br style=3D"font-family:Helvetica;font-size:12px;font-style:normal= ;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:= start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0= px;text-decoration-line:none;text-decoration-style:solid"><a href=3D"https:= //lists.gnu.org/archive/html/bug-ncurses/2026-02/msg00025.html" style=3D"fo= nt-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:norm= al;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;t= ext-transform:none;white-space:normal;word-spacing:0px" rel=3D"noreferrer n= oreferrer" target=3D"_blank">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-variant-caps:normal;font-weight:400;letter-spacing:= normal;text-align:start;text-indent:0px;text-transform:none;white-space:nor= mal;word-spacing:0px;text-decoration-line:none;text-decoration-style:solid"= ><br style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-v= ariant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;t= ext-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text= -decoration-line:none;text-decoration-style:solid"><blockquote type=3D"cite= " style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-vari= ant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text= -indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-de= coration-line:none;text-decoration-style:solid">The issue does NOT occur wi= th 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-variant-caps:normal;font-weight:400;letter-spacing:normal;text-= align:start;text-indent:0px;text-transform:none;white-space:normal;word-spa= cing:0px;text-decoration-line:none;text-decoration-style:solid"><span style= =3D"font-family:Helvetica;font-size:12px;font-style:normal;font-variant-cap= s:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent= :0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoratio= n:none;float:none;display:inline">This isn't the Ubuntu bug-reporting s= ystem.=C2=A0 Since Ubuntu only</span><br style=3D"font-family:Helvetica;fon= t-size:12px;font-style:normal;font-variant-caps:normal;font-weight:400;lett= er-spacing:normal;text-align:start;text-indent:0px;text-transform:none;whit= e-space:normal;word-spacing:0px;text-decoration-line:none;text-decoration-s= tyle:solid"><span style=3D"font-family:Helvetica;font-size:12px;font-style:= normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-= align:start;text-indent:0px;text-transform:none;white-space:normal;word-spa= cing:0px;text-decoration:none;float:none;display:inline">mirrors ncurses up= dates from Debian, the place to report Ubuntu issues</span><br style=3D"fon= t-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:norma= l;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;te= xt-transform:none;white-space:normal;word-spacing:0px;text-decoration-line:= none;text-decoration-style:solid"><span style=3D"font-family:Helvetica;font= -size:12px;font-style:normal;font-variant-caps:normal;font-weight:400;lette= r-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white= -space:normal;word-spacing:0px;text-decoration:none;float:none;display:inli= ne">is in Debian.</span><br style=3D"font-family:Helvetica;font-size:12px;f= ont-style:normal;font-variant-caps:normal;font-weight:400;letter-spacing:no= rmal;text-align:start;text-indent:0px;text-transform:none;white-space:norma= l;word-spacing:0px;text-decoration-line:none;text-decoration-style:solid"><= br style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-var= iant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;tex= t-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-varian= t-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-i= ndent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-deco= ration-line:none;text-decoration-style:solid"><br>ENVIRONMENT<br><br>=C2=A0= OS: =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0Ubuntu 24.04.4 LTS<br>=C2=A0Kernel:= =C2=A0=C2=A06.8.0-107-generic x86_64<br>=C2=A0tmux: =C2=A0=C2=A0=C2=A0=C2= =A03.6b (Homebrew)<br></blockquote><br style=3D"font-family:Helvetica;font-= size:12px;font-style:normal;font-variant-caps:normal;font-weight:400;letter= -spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-= space:normal;word-spacing:0px;text-decoration-line:none;text-decoration-sty= le:solid"><span style=3D"font-family:Helvetica;font-size:12px;font-style:no= rmal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-al= ign:start;text-indent:0px;text-transform:none;white-space:normal;word-spaci= ng:0px;text-decoration:none;float:none;display:inline">Homebrew isn't U= buntu - it's MacOS.</span><br style=3D"font-family:Helvetica;font-size:= 12px;font-style:normal;font-variant-caps:normal;font-weight:400;letter-spac= ing:normal;text-align:start;text-indent:0px;text-transform:none;white-space= :normal;word-spacing:0px;text-decoration-line:none;text-decoration-style:so= lid"><br style=3D"font-family:Helvetica;font-size:12px;font-style:normal;fo= nt-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:sta= rt;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;= text-decoration-line:none;text-decoration-style:solid"><blockquote type=3D"= cite" style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-= variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;= text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;tex= t-decoration-line:none;text-decoration-style:solid">=C2=A0ncurses: =C2=A06.= 6.20251230 (Homebrew, wide-char build)<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A06.5.20240427 (built from source, same conf= igure flags)<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A06.4+20240113 (Ubuntu system /lib/x86_64-linux-gnu)<br></blockquote= ><br style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-v= ariant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;t= ext-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text= -decoration-line:none;text-decoration-style:solid"><span style=3D"font-fami= ly:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font= -weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-tra= nsform:none;white-space:normal;word-spacing:0px;text-decoration: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-variant-caps:normal;font-weight:400;letter-spacing:= normal;text-align:start;text-indent:0px;text-transform:none;white-space:nor= mal;word-spacing:0px;text-decoration-line:none;text-decoration-style:solid"= ><span style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font= -variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start= ;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;te= xt-decoration:none;float:none;display:inline">far from that, either).=C2=A0= If you're going to do all of that, you</span><br style=3D"font-family:= Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-we= ight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transf= orm:none;white-space:normal;word-spacing:0px;text-decoration-line:none;text= -decoration-style:solid"><span style=3D"font-family:Helvetica;font-size:12p= x;font-style:normal;font-variant-caps:normal;font-weight:400;letter-spacing= :normal;text-align:start;text-indent:0px;text-transform:none;white-space:no= rmal;word-spacing:0px;text-decoration:none;float:none;display:inline">shoul= d be able to configure ncurses for traces and provide that information.</sp= an><br style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font= -variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start= ;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;te= xt-decoration-line:none;text-decoration-style:solid"><br style=3D"font-fami= ly:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font= -weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-tra= nsform:none;white-space:normal;word-spacing:0px;text-decoration-line:none;t= ext-decoration-style:solid"><blockquote type=3D"cite" style=3D"font-family:= Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-we= ight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transf= orm:none;white-space:normal;word-spacing:0px;text-decoration-line:none;text= -decoration-style:solid">REPRODUCTION<br><br>=C2=A0# Using tmux 3.6b linked= against ncurses 6.6:<br>=C2=A0$ tmux new -d -s test<br>=C2=A0$ tmux attach= -t test<br>=C2=A0open terminal failed: not a terminal<br><br>=C2=A0This ha= ppens in:<br>=C2=A0- Interactive SSH sessions (ssh user@host, then tmux a)<= br>=C2=A0- VS Code Remote integrated terminal<br>=C2=A0- PTYs created by sc= ript(1)<br><br>=C2=A0The ONLY working case is ssh -t host "tmux a -t t= est" (forced PTY<br>=C2=A0with terminal size forwarding from the SSH c= lient).<br><br><br>ISOLATION<br><br>=C2=A0Same tmux 3.6b binary, different = ncurses library at runtime:<br><br>=C2=A0| ncurses =C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0| method =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0| resu= lt =C2=A0|<br>=C2=A0|-------------------|----------------------------------= ---|---------|<br>=C2=A0| 6.6.20251230 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0| defa= ult brew linkage =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0| FAIL =C2=A0=C2=A0=C2=A0|<br>=C2=A0| 6.5.= 20240427 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0| LD_LIBRARY_PATH=3D.../ncurses-6.5/= lib | OK =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0|<br>=C2=A0| 6.4 (system) =C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0| LD_LIBRARY_PATH=3D/lib/x86_64-linux-gnu | OK =C2=A0= =C2=A0=C2=A0|<br><br>=C2=A0Commands to reproduce the isolation test:<br><br= >=C2=A0=C2=A0=C2=A0# FAIL with 6.6<br>=C2=A0=C2=A0=C2=A0script -qc 'tmu= x -S /tmp/t66 new -d -s x && \<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0tmux -S /tmp= /t66 a -t x' /dev/null<br><br>=C2=A0=C2=A0=C2=A0# OK with 6.5<br>=C2=A0= =C2=A0=C2=A0script -qc 'LD_LIBRARY_PATH=3D/path/to/ncurses-6.5/lib \<br= >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0tmux -S /tmp/t65 new -d -s x && \<br>=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0LD_LIBRARY_PATH=3D/path/to/ncurses-6.5/lib \<br>=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0tmux -S /tmp/t65 a -t x' /dev/null<br><br><br>MECHANISM<br><br= >=C2=A0tmux's server receives the client's PTY fd via SCM_RIGHTS, t= hen<br>=C2=A0calls tty_init() -> setupterm(). With ncurses 6.6, setupter= m()<br>=C2=A0apparently rejects the terminal, causing tty_init() to return = -1.<br></blockquote><br style=3D"font-family:Helvetica;font-size:12px;font-= style:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal= ;text-align:start;text-indent:0px;text-transform:none;white-space:normal;wo= rd-spacing:0px;text-decoration-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-dec= oration:none;float:none;display:inline">"apparently" can be used = with lots of supporting data (actual</span><br style=3D"font-family:Helveti= ca;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:40= 0;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:non= e;white-space:normal;word-spacing:0px;text-decoration-line:none;text-decora= tion-style:solid"><span style=3D"font-family:Helvetica;font-size:12px;font-= style:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal= ;text-align:start;text-indent:0px;text-transform:none;white-space:normal;wo= rd-spacing:0px;text-decoration: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-variant-caps:normal;font-weight:400;l= etter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;w= hite-space:normal;word-spacing:0px;text-decoration-line:none;text-decoratio= n-style:solid"><br style=3D"font-family:Helvetica;font-size:12px;font-style= :normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text= -align:start;text-indent:0px;text-transform:none;white-space:normal;word-sp= acing:0px;text-decoration-line:none;text-decoration-style:solid"><blockquot= e type=3D"cite" style=3D"font-family:Helvetica;font-size:12px;font-style:no= rmal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-al= ign:start;text-indent:0px;text-transform:none;white-space:normal;word-spaci= ng:0px;text-decoration-line:none;text-decoration-style:solid">=C2=A0This le= aves the CLIENT_TERMINAL flag unset, and server_client_open()<br>=C2=A0retu= rns "not a terminal".<br><br>=C2=A0strace shows the PTY is valid = =E2=80=94 TCGETS succeeds, the fd resolves<br>=C2=A0to /dev/pts/N, and perm= issions are correct (crw--w---- owner:tty).<br></blockquote><br style=3D"fo= nt-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:norm= al;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;t= ext-transform:none;white-space:normal;word-spacing:0px;text-decoration-line= :none;text-decoration-style:solid"><span style=3D"font-family:Helvetica;fon= t-size:12px;font-style:normal;font-variant-caps:normal;font-weight:400;lett= er-spacing:normal;text-align:start;text-indent:0px;text-transform:none;whit= e-space:normal;word-spacing:0px;text-decoration:none;float:none;display:inl= ine">I don't see a trace (and in any case, this report deals with a lar= ge system,</span><br style=3D"font-family:Helvetica;font-size:12px;font-sty= le:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;te= xt-align:start;text-indent:0px;text-transform:none;white-space:normal;word-= spacing:0px;text-decoration-line:none;text-decoration-style:solid"><span st= yle=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-variant-= caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-ind= ent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decora= tion:none;float:none;display:inline">in which things can be misconfigured)<= /span><br style=3D"font-family:Helvetica;font-size:12px;font-style:normal;f= ont-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:st= art;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px= ;text-decoration-line:none;text-decoration-style:solid"><br style=3D"font-f= amily:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;f= ont-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-= transform:none;white-space:normal;word-spacing:0px;text-decoration-line:non= e;text-decoration-style:solid"><blockquote type=3D"cite" style=3D"font-fami= ly:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font= -weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-tra= nsform:none;white-space:normal;word-spacing:0px;text-decoration-line:none;t= ext-decoration-style:solid">=C2=A0The tmux source code for this path is ide= ntical between 3.4 and<br>=C2=A03.6b, confirming the behavioral change is i= n ncurses, not tmux.<br><br><br>BUILD FLAGS (both 6.5 and 6.6 built with):<= br><br>=C2=A0./configure --prefix=3D... --with-shared --with-widec \<br>=C2= =A0=C2=A0=C2=A0--enable-pc-files --enable-sigwinch --enable-ext-colors \<br= >=C2=A0=C2=A0=C2=A0--without-debug --without-ada<br><br><br>I haven't b= isected the exact ncurses patch between 6.5 and 6.6 yet.<br>Happy to test p= atches or provide additional traces if helpful.<br></blockquote><br style= =3D"font-family:Helvetica;font-size:12px;font-style:normal;font-variant-cap= s:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent= :0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoratio= n-line:none;text-decoration-style:solid"><span style=3D"font-family:Helveti= ca;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:40= 0;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:non= e;white-space:normal;word-spacing:0px;text-decoration:none;float:none;displ= ay:inline">That's about 18 months of changes :-)</span><br style=3D"fon= t-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:norma= l;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;te= xt-transform:none;white-space:normal;word-spacing:0px;text-decoration-line:= none;text-decoration-style:solid"><br style=3D"font-family:Helvetica;font-s= ize:12px;font-style:normal;font-variant-caps:normal;font-weight:400;letter-= spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-s= pace:normal;word-spacing:0px;text-decoration-line:none;text-decoration-styl= e:solid"><span style=3D"font-family:Helvetica;font-size:12px;font-style:nor= mal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-ali= gn:start;text-indent:0px;text-transform:none;white-space:normal;word-spacin= g:0px;text-decoration:none;float:none;display:inline">--<span>=C2=A0</span>= </span><br style=3D"font-family:Helvetica;font-size:12px;font-style:normal;= font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:s= tart;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0p= x;text-decoration-line:none;text-decoration-style:solid"><span style=3D"fon= t-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:norma= l;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;te= xt-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;= float:none;display:inline">Thomas E. Dickey <</span><a href=3D"mailto:di= [email protected]" style=3D"font-family:Helvetica;font-size:12px;fo= nt-style:normal;font-variant-caps:normal;font-weight:400;letter-spacing:nor= mal;text-align:start;text-indent:0px;text-transform:none;white-space:normal= ;word-spacing:0px" rel=3D"noreferrer noreferrer" target=3D"_blank">dickey@i= nvisible-island.net</a><span style=3D"font-family:Helvetica;font-size:12px;= font-style:normal;font-variant-caps:normal;font-weight:400;letter-spacing:n= ormal;text-align:start;text-indent:0px;text-transform:none;white-space:norm= al;word-spacing:0px;text-decoration:none;float:none;display:inline">></s= pan><br style=3D"font-family:Helvetica;font-size:12px;font-style:normal;fon= t-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:star= t;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;t= ext-decoration-line:none;text-decoration-style:solid"><a href=3D"https://in= visible-island.net/" style=3D"font-family:Helvetica;font-size:12px;font-sty= le:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;te= xt-align:start;text-indent:0px;text-transform:none;white-space:normal;word-= spacing:0px" rel=3D"noreferrer noreferrer" target=3D"_blank">https://invisi= ble-island.net</a></div></blockquote></div><br></div></blockquote></div></d= iv></div> </div></blockquote></div><br></div></blockquote></div> --00000000000073480d0652c93846--