Re: ncurses 6.6 regression: setupterm() rejects valid PTY, breaks tmux attach

Nicholas Marriott <[email protected]> Wed, 27 May 2026 10:15:37 +0100
Newsgroups gmane.comp.lib.ncurses.bugs
Message-ID <CAEdLfcEXS4tm0+ppzdZH+LQm+cDsPCUtB2GaccYgq==mhATpvA@mail.gmail.com>
--000000000000b252970652c90e0e
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

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 correction=
:
> 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. 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.
>
>
> 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=3D0x800=
0,
> 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".
>
> 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).
>
>
> 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 wa=
s
>    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 disappear=
s 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@in=
visible-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 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=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
>
>
>

--000000000000b252970652c90e0e
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"auto"><div>This was already mentioned in the tmux 3.6 release n=
otes, 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://g=
ithub.com/tmux/tmux/issues/4699</a></div><div dir=3D"auto"><br></div><div d=
ir=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, &lt;<a hre=
f=3D"mailto:[email protected]">[email protected]</a>&gt; wrote:<br></div><blockquote cl=
ass=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><d=
iv><br></div><div>Thank you for your reply and pointers. I&#39;m writing ba=
ck with a correction:</div><div>after further investigation, I&#39;ve deter=
mined 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><di=
v>The &quot;open terminal failed: not a terminal&quot; error is caused by a=
 tmux</div><div>client/server version mismatch after a Homebrew upgrade, no=
t by ncurses</div><div>6.6&#39;s setupterm(). ncurses is innocent here.</di=
v><div><br></div><div><br></div><div>WHAT WENT WRONG WITH MY ORIGINAL ANALY=
SIS</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 h=
ardcoded DT_RPATH (not DT_RUNPATH)</div><div>pointing to its ncurses direct=
ory. DT_RPATH takes priority over</div><div>LD_LIBRARY_PATH, so all three t=
est groups were actually running with</div><div>ncurses 6.6 =E2=80=94 the t=
est was invalid.</div><div><br></div><div>The real variable I failed to con=
trol 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 struc=
t</div><div>imsg_hdr 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>The old library marks &quot;message carries an fd&quot; wit=
h flags &amp; IMSGF_HASFD</div><div>(bit 0 of the flags field). The new lib=
rary uses len &amp; 0x80000000</div><div>(bit 31 of the widened len field),=
 with the flags field removed entirely.</div><div><br></div><div>When the n=
ew client sends MSG_IDENTIFY_STDIN (carrying the terminal fd),</div><div>th=
e old server misparses the header: it reads len=3D0x0010, flags=3D0x8000,</=
div><div>and since 0x8000 &amp; IMSGF_HASFD(0x0001) =3D=3D 0, it never dequ=
eues the fd.</div><div>The client&#39;s terminal fd is lost, isatty() fails=
 on a stale fd, and tmux</div><div>reports &quot;not a terminal&quot;.</div=
><div><br></div><div>I confirmed this with strace (ioctl(TCGETS) returns EN=
OTTY 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><d=
iv>1. &quot;Homebrew isn&#39;t Ubuntu - it&#39;s MacOS&quot;</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 used on Linux</div><div>=C2=A0 =C2=A0servers and in CI enviro=
nments. My setup =E2=80=94 Homebrew on Ubuntu =E2=80=94 is a</div><div>=C2=
=A0 =C2=A0supported configuration, not an exotic one.</div><div><br></div><=
div>2. &quot;This isn&#39;t the Ubuntu bug-reporting system&quot;</div><div=
><br></div><div>=C2=A0 =C2=A0Understood. I was not reporting an Ubuntu/Debi=
an packaging issue. I was</div><div>=C2=A0 =C2=A0reporting what I believed =
to be a regression in ncurses 6.6 itself,</div><div>=C2=A0 =C2=A0tested wit=
h a from-source build using the same configure flags. As it</div><div>=C2=
=A0 =C2=A0turns out, the bug was not in ncurses at all, so this is moot.</d=
iv><div><br></div><div>3. The 2026-02 report you referenced (bug-ncurses/20=
26-02/msg00025)</div><div><br></div><div>=C2=A0 =C2=A0That earlier report m=
ay or may not be the same issue. If the reporter</div><div>=C2=A0 =C2=A0was=
 also hitting a tmux version mismatch after an upgrade, it would</div><div>=
=C2=A0 =C2=A0explain why no reproducer was provided =E2=80=94 the problem d=
isappears once</div><div>=C2=A0 =C2=A0the old server is killed. It might be=
 worth asking them whether they</div><div>=C2=A0 =C2=A0had recently upgrade=
d 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</div><div>=C2=A0 trace output.</div><div>- The bug is in tmu=
x&#39;s cross-version compatibility (or lack thereof)</div><div>=C2=A0 afte=
r an imsg library ABI change.</div><div>- I&#39;ve updated the Homebrew iss=
ue (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 compatibility without bumping PROTOCOL_VERSION),</div><div>would yo=
u recommend I report this to the tmux project? If so, could you</div><div>s=
uggest 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-us=
ers mailing list?</div><div><br></div><div>Again, I apologize for the incor=
rect report and for taking your time.</div><div>Thank you for maintaining n=
curses.</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 &lt;<a href=3D"mailto:dickey@invisible-i=
sland.net" target=3D"_blank" rel=3D"noreferrer">[email protected]=
</a>&gt; =E5=86=99=E9=81=93=EF=BC=9A</div><br><div><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">On Mon, May 25, 2026 at 10:15:16AM +0800, Liam Huang w=
rote:</span><br 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"><blockquote t=
ype=3D"cite" style=3D"font-family:Helvetica;font-size:12px;font-style:norma=
l;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-style:solid">Hi,<br><br>I&#39=
;ve found a regression in ncurses 6.6 (patchdate 20251230) where<br>setupte=
rm() fails on valid Linux pseudo-terminals, causing tmux&#39;s<br>tty_init(=
) to fail and &quot;open terminal failed: not a terminal&quot; on attach.<b=
r></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-sp=
acing:0px;text-decoration-line:none;text-decoration-style:solid"><span styl=
e=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-variant-ca=
ps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-inden=
t:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decorati=
on:none;float:none;display:inline">This sounds like a bug which was reporte=
d 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;lette=
r-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white=
-space:normal;word-spacing:0px;text-decoration-line:none;text-decoration-st=
yle:solid"><span style=3D"font-family:Helvetica;font-size:12px;font-style:n=
ormal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-a=
lign:start;text-indent:0px;text-transform:none;white-space:normal;word-spac=
ing:0px;text-decoration:none;float:none;display:inline">way to reproduce it=
 -<span>=C2=A0</span></span><br style=3D"font-family:Helvetica;font-size:12=
px;font-style:normal;font-variant-caps:normal;font-weight:400;letter-spacin=
g:normal;text-align:start;text-indent:0px;text-transform:none;white-space:n=
ormal;word-spacing:0px;text-decoration-line:none;text-decoration-style:soli=
d"><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"><a href=3D"https://lis=
ts.gnu.org/archive/html/bug-ncurses/2026-02/msg00025.html" style=3D"font-fa=
mily:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;fo=
nt-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-t=
ransform:none;white-space:normal;word-spacing:0px" target=3D"_blank" rel=3D=
"noreferrer">https://lists.gnu.org/archive/html/bug-ncurses/2026-02/msg0002=
5.html</a><br style=3D"font-family:Helvetica;font-size:12px;font-style:norm=
al;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-alig=
n:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing=
:0px;text-decoration-line:none;text-decoration-style:solid"><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"><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;text-decoration-line:no=
ne;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><b=
r 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"><span 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:none;float:non=
e;display:inline">This isn&#39;t the Ubuntu bug-reporting system.=C2=A0 Sin=
ce Ubuntu only</span><br style=3D"font-family:Helvetica;font-size:12px;font=
-style:normal;font-variant-caps:normal;font-weight:400;letter-spacing:norma=
l;text-align:start;text-indent:0px;text-transform:none;white-space:normal;w=
ord-spacing:0px;text-decoration-line:none;text-decoration-style:solid"><spa=
n 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:none;float:none;display:inline">mirrors ncurses updates from Debia=
n, the place to report Ubuntu issues</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">is in Debian=
.</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:0=
px;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;tex=
t-transform:none;white-space:normal;word-spacing:0px;text-decoration-line:n=
one;text-decoration-style:solid"><blockquote type=3D"cite" style=3D"font-fa=
mily:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;fo=
nt-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-t=
ransform:none;white-space:normal;word-spacing:0px;text-decoration-line:none=
;text-decoration-style:solid"><br>ENVIRONMENT<br><br>=C2=A0OS: =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-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-line:none;text-decoration-style:solid"><span s=
tyle=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-variant=
-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-in=
dent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decor=
ation:none;float:none;display:inline">Homebrew isn&#39;t Ubuntu - it&#39;s =
MacOS.</span><br style=3D"font-family:Helvetica;font-size:12px;font-style:n=
ormal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-a=
lign:start;text-indent:0px;text-transform:none;white-space:normal;word-spac=
ing:0px;text-decoration-line:none;text-decoration-style:solid"><br style=3D=
"font-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:n=
ormal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0p=
x;text-transform:none;white-space:normal;word-spacing:0px;text-decoration-l=
ine:none;text-decoration-style:solid"><blockquote type=3D"cite" 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">=C2=A0ncurses: =C2=A06.6.20251230 (Homeb=
rew, 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 configure 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+2024=
0113 (Ubuntu system /lib/x86_64-linux-gnu)<br></blockquote><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">That&#39;s 3 versions of ncurses, one self-built, and (Homebrew isn&#39=
;t</span><br style=3D"font-family:Helvetica;font-size:12px;font-style:norma=
l;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-style:solid"><span style=3D"f=
ont-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:nor=
mal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;=
text-transform:none;white-space:normal;word-spacing:0px;text-decoration:non=
e;float:none;display:inline">far from that, either).=C2=A0 If you&#39;re go=
ing to do all of that, you</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"><span style=3D"font-family:Helvetica;font-size:12px;font-style:norm=
al;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-alig=
n:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing=
:0px;text-decoration:none;float:none;display:inline">should be able to conf=
igure ncurses for traces and provide that information.</span><br style=3D"f=
ont-family:Helvetica;font-size:12px;font-style:normal;font-variant-caps:nor=
mal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;=
text-transform:none;white-space:normal;word-spacing:0px;text-decoration-lin=
e:none;text-decoration-style:solid"><br 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-line:none;text-decoration-st=
yle:solid"><blockquote type=3D"cite" 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">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 happens 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 script(1)<br><b=
r>=C2=A0The ONLY working case is ssh -t host &quot;tmux a -t test&quot; (fo=
rced PTY<br>=C2=A0with terminal size forwarding from the SSH client).<br><b=
r><br>ISOLATION<br><br>=C2=A0Same tmux 3.6b binary, different ncurses libra=
ry 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| result =C2=A0|<b=
r>=C2=A0|-------------------|-------------------------------------|--------=
-|<br>=C2=A0| 6.6.20251230 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0| default brew lin=
kage =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 &#39;tmux -S /tmp/t66=
 new -d -s x &amp;&amp; \<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&=
#39; /dev/null<br><br>=C2=A0=C2=A0=C2=A0# OK with 6.5<br>=C2=A0=C2=A0=C2=A0=
script -qc &#39;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 &amp;&amp; \<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=A0tmu=
x -S /tmp/t65 a -t x&#39; /dev/null<br><br><br>MECHANISM<br><br>=C2=A0tmux&=
#39;s server receives the client&#39;s PTY fd via SCM_RIGHTS, then<br>=C2=
=A0calls tty_init() -&gt; setupterm(). With ncurses 6.6, setupterm()<br>=C2=
=A0apparently rejects the terminal, causing tty_init() to return -1.<br></b=
lockquote><br style=3D"font-family:Helvetica;font-size:12px;font-style:norm=
al;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-alig=
n:start;text-indent:0px;text-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:no=
rmal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px=
;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:no=
ne;float:none;display:inline">&quot;apparently&quot; can be used with lots =
of supporting data (actual</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"><span style=3D"font-family:Helvetica;font-size:12px;font-style:norm=
al;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-alig=
n:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing=
:0px;text-decoration:none;float:none;display:inline">system calls used, alo=
ng with their results).</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=A0This leaves the C=
LIENT_TERMINAL flag unset, and server_client_open()<br>=C2=A0returns &quot;=
not a terminal&quot;.<br><br>=C2=A0strace shows the PTY is valid =E2=80=94 =
TCGETS succeeds, the fd resolves<br>=C2=A0to /dev/pts/N, and permissions ar=
e correct (crw--w---- owner:tty).<br></blockquote><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">I don=
&#39;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-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">in which things can be misconfigured)</span><br =
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 style=3D"font-family:Helv=
etica;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-dec=
oration-style:solid"><blockquote type=3D"cite" 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">=C2=A0The tmux source code for this path is identical bet=
ween 3.4 and<br>=C2=A03.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>=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&#39;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-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:no=
ne;text-decoration-style:solid"><span 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:none;float:none;display:inline=
">That&#39;s about 18 months of changes :-)</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"><br 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-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;tex=
t-decoration:none;float:none;display:inline">--<span>=C2=A0</span></span><b=
r 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"><span 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:none;float:non=
e;display:inline">Thomas E. Dickey &lt;</span><a href=3D"mailto:dickey@invi=
sible-island.net" 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" target=3D"_blank" rel=3D"noreferrer">[email protected]<=
/a><span 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:none;float:none;display:inline">&gt;</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"><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></bloc=
kquote></div><br></div></blockquote></div></div></div>

--000000000000b252970652c90e0e--