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

"Johann 'Myrkraverk' Oskarsson" <[email protected]> Wed, 27 May 2026 16:59:09 +0800
Newsgroups gmane.comp.lib.ncurses.bugs
Message-ID <CAA_SOw8W-EmgkOWZG5EaXpQ2j40L0R8bREf-tmrKKFcpdMKYsA@mail.gmail.com>
--000000000000daf62e0652c8d327
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Dear Liam, Thomas, Ncurses Mailing List,

Isn't the iMSG library at https://github.com/openclaw/imsg and part of the
Mac OS operating system?  Is this a Linux bug report that gets bounced back
to a completely different Single Unix Specification error?

Johann

 I'm not from the internet, I just work there.

On Wed, May 27, 2026, 3:27=E2=80=AFPM 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
>
>
>

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

<div dir=3D"auto"><div dir=3D"auto"><div>Dear Liam, Thomas, Ncurses Mailing=
 List,</div><div dir=3D"auto"><br></div><div dir=3D"auto">Isn&#39;t the iMS=
G library at=C2=A0<a href=3D"https://github.com/openclaw/imsg">https://gith=
ub.com/openclaw/imsg</a> and part of the Mac OS operating system?=C2=A0 Is =
this a Linux bug report that gets bounced back to a completely different Si=
ngle Unix Specification error?</div><div><br></div><div data-smartmail=3D"g=
mail_signature">Johann<br><br> =C2=A0I&#39;m not from the internet, I just =
work there.</div></div><br><div class=3D"gmail_quote"><div dir=3D"ltr" clas=
s=3D"gmail_attr">On Wed, May 27, 2026, 3:27=E2=80=AFPM Liam Huang &lt;<a hr=
ef=3D"mailto:[email protected]" target=3D"_blank" rel=3D"noreferrer">[email protected]<=
/a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0=
 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style=3D"line-b=
reak:after-white-space"><div>Hi Thomas,</div><div><br></div><div>Thank you =
for your reply and pointers. I&#39;m writing back with a correction:</div><=
div>after further investigation, I&#39;ve determined that this is NOT an nc=
urses</div><div>bug. I apologize for the noise.</div><div><br></div><div><b=
r></div><div>CORRECTION</div><div><br></div><div>The &quot;open terminal fa=
iled: not a terminal&quot; error is caused by a tmux</div><div>client/serve=
r version mismatch after a Homebrew upgrade, not by ncurses</div><div>6.6&#=
39;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><d=
iv>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_RU=
NPATH)</div><div>pointing to its ncurses directory. DT_RPATH takes priority=
 over</div><div>LD_LIBRARY_PATH, so all three test groups were actually run=
ning 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 ver=
sion. Before</div><div>`brew upgrade`, an older tmux (3.5a) server was stil=
l running. After the</div><div>upgrade, the new 3.6b client connected to th=
e old server, triggering the</div><div>failure.</div><div><br></div><div><b=
r></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>=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 libr=
ary marks &quot;message carries an fd&quot; with flags &amp; IMSGF_HASFD</d=
iv><div>(bit 0 of the flags field). The new library uses len &amp; 0x800000=
00</div><div>(bit 31 of the widened len field), with the flags field remove=
d 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 h=
eader: it reads len=3D0x0010, flags=3D0x8000,</div><div>and since 0x8000 &a=
mp; IMSGF_HASFD(0x0001) =3D=3D 0, it never dequeues the fd.</div><div>The c=
lient&#39;s terminal fd is lost, isatty() fails on a stale fd, and tmux</di=
v><div>reports &quot;not a terminal&quot;.</div><div><br></div><div>I confi=
rmed this with strace (ioctl(TCGETS) returns ENOTTY on the</div><div>receiv=
ed 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 sma=
ll points, respectfully:</div><div><br></div><div>1. &quot;Homebrew isn&#39=
;t Ubuntu - it&#39;s MacOS&quot;</div><div><br></div><div>=C2=A0 =C2=A0Home=
brew 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 environments. My setup =E2=80=94 H=
omebrew on Ubuntu =E2=80=94 is a</div><div>=C2=A0 =C2=A0supported configura=
tion, not an exotic one.</div><div><br></div><div>2. &quot;This isn&#39;t t=
he Ubuntu bug-reporting system&quot;</div><div><br></div><div>=C2=A0 =C2=A0=
Understood. I was not reporting an Ubuntu/Debian packaging issue. I was</di=
v><div>=C2=A0 =C2=A0reporting what I believed to be a regression in ncurses=
 6.6 itself,</div><div>=C2=A0 =C2=A0tested with a from-source build using t=
he same configure flags. As it</div><div>=C2=A0 =C2=A0turns out, the bug wa=
s not in ncurses at all, so this is moot.</div><div><br></div><div>3. The 2=
026-02 report you referenced (bug-ncurses/2026-02/msg00025)</div><div><br><=
/div><div>=C2=A0 =C2=A0That earlier report may or may not be the same issue=
. If the reporter</div><div>=C2=A0 =C2=A0was also hitting a tmux version mi=
smatch after an upgrade, it would</div><div>=C2=A0 =C2=A0explain why no rep=
roducer was provided =E2=80=94 the problem disappears 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 upgraded tmux.</div><div><br></div><di=
v><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 re=
producer (SCM_RIGHTS fd passing + setupterm()) and ncurses</div><div>=C2=A0=
 trace output.</div><div>- The bug is in tmux&#39;s cross-version compatibi=
lity (or lack thereof)</div><div>=C2=A0 after an imsg library ABI change.</=
div><div>- I&#39;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 compatibility without b=
umping PROTOCOL_VERSION),</div><div>would you recommend I report this to th=
e 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://gi=
thub.com/tmux/tmux/issues" rel=3D"noreferrer noreferrer" target=3D"_blank">=
https://github.com/tmux/tmux/issues</a>, or the tmux-users mailing list?</d=
iv><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><b=
r></div><div>Best regards,</div><div>Liam</div><div><br></div><div><br><blo=
ckquote 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:[email protected]" rel=3D"=
noreferrer noreferrer" target=3D"_blank">[email protected]</a>&gt=
; =E5=86=99=E9=81=93=EF=BC=9A</div><br><div><span 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:none;float:none;di=
splay:inline!important">On Mon, May 25, 2026 at 10:15:16AM +0800, Liam Huan=
g wrote:</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-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">Hi,<br><br>I&=
#39;ve found a regression in ncurses 6.6 (patchdate 20251230) where<br>setu=
pterm() fails on valid Linux pseudo-terminals, causing tmux&#39;s<br>tty_in=
it() to fail and &quot;open terminal failed: not a terminal&quot; on attach=
.<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!important">This sounds like a bug whic=
h was reported in tmux without providing a</span><br style=3D"font-family:H=
elvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-wei=
ght:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transfo=
rm: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;letter-spacing:=
normal;text-align:start;text-indent:0px;text-transform:none;white-space:nor=
mal;word-spacing:0px;text-decoration:none;float:none;display:inline!importa=
nt">way to reproduce it -<span>=C2=A0</span></span><br style=3D"font-family=
:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-w=
eight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-trans=
form:none;white-space:normal;word-spacing:0px;text-decoration-line:none;tex=
t-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:nor=
mal;word-spacing:0px;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"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" r=
el=3D"noreferrer noreferrer" target=3D"_blank">https://lists.gnu.org/archiv=
e/html/bug-ncurses/2026-02/msg00025.html</a><br style=3D"font-family:Helvet=
ica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:4=
00;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:no=
ne;white-space:normal;word-spacing:0px;text-decoration-line:none;text-decor=
ation-style:solid"><br style=3D"font-family:Helvetica;font-size:12px;font-s=
tyle:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;=
text-align:start;text-indent:0px;text-transform:none;white-space:normal;wor=
d-spacing:0px;text-decoration-line:none;text-decoration-style:solid"><block=
quote type=3D"cite" style=3D"font-family:Helvetica;font-size:12px;font-styl=
e:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;tex=
t-align:start;text-indent:0px;text-transform:none;white-space:normal;word-s=
pacing:0px;text-decoration-line:none;text-decoration-style:solid">The issue=
 does NOT occur with ncurses 6.5 (patchdate 20240427) or<br>the Ubuntu syst=
em ncurses 6.4.<br></blockquote><br style=3D"font-family:Helvetica;font-siz=
e:12px;font-style:normal;font-variant-caps:normal;font-weight:400;letter-sp=
acing:normal;text-align:start;text-indent:0px;text-transform:none;white-spa=
ce:normal;word-spacing:0px;text-decoration-line:none;text-decoration-style:=
solid"><span 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:none;float:none;display:inline!important">This isn&#39;=
t the Ubuntu bug-reporting system.=C2=A0 Since Ubuntu only</span><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!important">mirrors ncurses updates from Debian, the place to repo=
rt Ubuntu issues</span><br 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;text-decoration-line:none;text-decoration-style:solid"><s=
pan style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-va=
riant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;te=
xt-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-=
decoration:none;float:none;display:inline!important">is in Debian.</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"><br style=3D"font-family:He=
lvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weig=
ht:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transfor=
m:none;white-space:normal;word-spacing:0px;text-decoration-line:none;text-d=
ecoration-style:solid"><blockquote type=3D"cite" style=3D"font-family:Helve=
tica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:=
400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:n=
one;white-space:normal;word-spacing:0px;text-decoration-line:none;text-deco=
ration-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-ge=
neric x86_64<br>=C2=A0tmux: =C2=A0=C2=A0=C2=A0=C2=A03.6b (Homebrew)<br></bl=
ockquote><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!important">Homebrew isn&#39;t Ubuntu - it&#39;s=
 MacOS.</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-spa=
cing:0px;text-decoration-line:none;text-decoration-style:solid"><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"><blockquote type=3D"cite" 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">=C2=A0ncurses: =C2=A06.6.20251230 (Ho=
mebrew, 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+2=
0240113 (Ubuntu system /lib/x86_64-linux-gnu)<br></blockquote><br 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-li=
ne:none;text-decoration-style:solid"><span style=3D"font-family:Helvetica;f=
ont-size:12px;font-style:normal;font-variant-caps:normal;font-weight:400;le=
tter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;wh=
ite-space:normal;word-spacing:0px;text-decoration:none;float:none;display:i=
nline!important">That&#39;s 3 versions of ncurses, one self-built, and (Hom=
ebrew isn&#39;t</span><br style=3D"font-family:Helvetica;font-size:12px;fon=
t-style:normal;font-variant-caps:normal;font-weight:400;letter-spacing:norm=
al;text-align:start;text-indent:0px;text-transform:none;white-space:normal;=
word-spacing:0px;text-decoration-line:none;text-decoration-style:solid"><sp=
an 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:none;float:none;display:inline!important">far from that, either).=
=C2=A0 If you&#39;re going to do all of that, you</span><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"><span 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:none;float:none;display:inline!=
important">should be able to configure ncurses for traces and provide that =
information.</span><br style=3D"font-family:Helvetica;font-size:12px;font-s=
tyle:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;=
text-align:start;text-indent:0px;text-transform:none;white-space:normal;wor=
d-spacing:0px;text-decoration-line:none;text-decoration-style:solid"><br 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-line:none;text-decoration-style:solid"><blockquote type=3D"cite" 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">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@hos=
t, then tmux a)<br>=C2=A0- VS Code Remote integrated terminal<br>=C2=A0- PT=
Ys created by script(1)<br><br>=C2=A0The ONLY working case is ssh -t host &=
quot;tmux a -t test&quot; (forced PTY<br>=C2=A0with terminal size forwardin=
g from the SSH client).<br><br><br>ISOLATION<br><br>=C2=A0Same tmux 3.6b bi=
nary, 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| result =C2=A0|<br>=C2=A0|-------------------|----------------=
---------------------|---------|<br>=C2=A0| 6.6.20251230 =C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0| default 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_PAT=
H=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-lin=
ux-gnu | OK =C2=A0=C2=A0=C2=A0|<br><br>=C2=A0Commands to reproduce the isol=
ation test:<br><br>=C2=A0=C2=A0=C2=A0# FAIL with 6.6<br>=C2=A0=C2=A0=C2=A0s=
cript -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=A0script -qc &#39;LD_LIBRARY_PATH=3D/path/to/nc=
urses-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=A0tmux -S /tmp/t65 a -t x&#39; /dev/null<br><br><b=
r>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 ncu=
rses 6.6, setupterm()<br>=C2=A0apparently rejects the terminal, causing tty=
_init() to return -1.<br></blockquote><br style=3D"font-family:Helvetica;fo=
nt-size:12px;font-style:normal;font-variant-caps:normal;font-weight:400;let=
ter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;whi=
te-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;letter-spacing:normal;text=
-align:start;text-indent:0px;text-transform:none;white-space:normal;word-sp=
acing:0px;text-decoration:none;float:none;display:inline!important">&quot;a=
pparently&quot; can be used with lots of supporting data (actual</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"><span style=3D"font-family:He=
lvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weig=
ht:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transfor=
m:none;white-space:normal;word-spacing:0px;text-decoration:none;float:none;=
display:inline!important">system calls used, along with their results).</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">=C2=A0This leaves the CLIENT_TERMINAL flag unset, =
and server_client_open()<br>=C2=A0returns &quot;not a terminal&quot;.<br><b=
r>=C2=A0strace shows the PTY is valid =E2=80=94 TCGETS succeeds, the fd res=
olves<br>=C2=A0to /dev/pts/N, and permissions are correct (crw--w---- owner=
:tty).<br></blockquote><br 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;text-decoration-line:none;text-decoration-style:solid"><s=
pan style=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-va=
riant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;te=
xt-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-=
decoration:none;float:none;display:inline!important">I don&#39;t see a trac=
e (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-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!important">in which things can be misconfigured)</span><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"><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"><blockquote type=3D"cite" style=3D"font-family:Helvetica;fo=
nt-size:12px;font-style:normal;font-variant-caps:normal;font-weight:400;let=
ter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;whi=
te-space:normal;word-spacing:0px;text-decoration-line:none;text-decoration-=
style:solid">=C2=A0The tmux source code for this path is identical between =
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 e=
xact ncurses patch between 6.5 and 6.6 yet.<br>Happy to test patches or pro=
vide additional traces if helpful.<br></blockquote><br style=3D"font-family=
:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;font-w=
eight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-trans=
form:none;white-space:normal;word-spacing:0px;text-decoration-line:none;tex=
t-decoration-style:solid"><span 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:none;float:none;display:inline!impor=
tant">That&#39;s about 18 months of changes :-)</span><br style=3D"font-fam=
ily:Helvetica;font-size:12px;font-style:normal;font-variant-caps:normal;fon=
t-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-tr=
ansform:none;white-space:normal;word-spacing:0px;text-decoration-line:none;=
text-decoration-style:solid"><br style=3D"font-family:Helvetica;font-size:1=
2px;font-style:normal;font-variant-caps:normal;font-weight:400;letter-spaci=
ng:normal;text-align:start;text-indent:0px;text-transform:none;white-space:=
normal;word-spacing:0px;text-decoration-line:none;text-decoration-style:sol=
id"><span 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:none;float:none;display:inline!important">--<span>=C2=A0</=
span></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"><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!important">Thomas E. Dickey &lt;</span><a =
href=3D"mailto:[email protected]" 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" rel=3D"noreferrer noreferrer" target=3D=
"_blank">[email protected]</a><span style=3D"font-family:Helvetic=
a;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:none;float:none;displa=
y:inline!important">&gt;</span><br style=3D"font-family:Helvetica;font-size=
:12px;font-style:normal;font-variant-caps:normal;font-weight:400;letter-spa=
cing:normal;text-align:start;text-indent:0px;text-transform:none;white-spac=
e:normal;word-spacing:0px;text-decoration-line:none;text-decoration-style:s=
olid"><a href=3D"https://invisible-island.net/" style=3D"font-family:Helvet=
ica;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:4=
00;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:no=
ne;white-space:normal;word-spacing:0px" rel=3D"noreferrer noreferrer" targe=
t=3D"_blank">https://invisible-island.net</a></div></blockquote></div><br><=
/div></blockquote></div>
<br><br></div>

--000000000000daf62e0652c8d327--