The screen entry in /etc/termcap has incorrect values for the standout mode capabilities: :se=\E[23m:so=\E[3m: \E[3m is the ANSI escape sequence for italic, not standout/reverse video. The correct values are: :se=\E[27m:so=\E[7m: This can be confirmed by noting that mr=\E[7m (reverse video) is correctly defined in the same entry — the right escape sequence was available but placed in the wrong capability. The screen-256color entry inherits from screen via tc=screen and is therefore also affected. The practical effect is that applications linking against base libtinfow display italic text where reverse video highlighting is expected. Confirmed with Alpine 2.26 inside a GNU Screen 5.0.1 session on FreeBSD 14. The fix is a one-line correction in the screen entry in /etc/termcap: :se=\E[23m:so=\E[3m: should be :se=\E[27m:so=\E[7m: Note that this entry ships in FreeBSD base and is present even on systems where the sysutils/screen port has never been installed.
Note: There's a related bug in Gnu Screen due to this behavior change. When screen was set up to support italics: (via this bug): https://savannah.gnu.org/bugs/?36676, people originally complained that it showed standout instead of italics. So screen added italics, but this exposed that inside many termcaps, including FreeBSD's, we're sending the wrong sequences. There's now an open PR in screen that it should do the right thing natively (this bug:) https://savannah.gnu.org/bugs/?func=detailitem&item_id=67436 But this can also be fixed by fixing the various system termcap entries. I've got a pull request ready to go for this (which can easily be backported if desired). Note that there may in fact be more new capabilities that gnu screen supports, and it may be worth updating this entry more fully. This just fixes the glaring error. If I need to upload broken screenshots of (say) Alpine, which relies heavily on reverse video, I can. -Dan
https://github.com/freebsd/freebsd-src/pull/2139
I've looped the gnu screen freebsd maintainer in on this, cy@.
Additional note on why the base termcap fix is necessary independent of any Screen-side workaround: The sysutils/screen port at version 5.0.1_6 emits a runtime workaround by writing duplicate so= and se= entries into $TERMCAP, with the correct reverse-video values appearing after the broken italic ones: so=\E[3m:se=\E[23m:so=\E[7m:se=\E[27m Termcap parsers generally take the last occurrence, so this works in the local session. However, $TERMCAP is not forwarded over SSH -- OpenSSH's SendEnv does not include it, and AcceptEnv on the remote side typically only lists $TERM. When a user SSHes from a machine running Screen to another machine and runs an affected application there, the remote system looks up the screen entry in its own /etc/termcap, encounters only the broken so=\E[3m, and displays italics instead of reverse video. Confirmed: with the per-user ~/.terminfo workaround removed on the remote system, the bug reappears immediately upon SSH. With the base /etc/termcap fix applied, no per-user workaround would be needed. This means the Screen port's runtime duplicate-entry approach, while useful, cannot substitute for fixing the base entry. The correct fix has to live in /etc/termcap itself.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=2bff747bb04db6beb19678abc45edd96be0a1347 commit 2bff747bb04db6beb19678abc45edd96be0a1347 Author: Dan Mahoney <github@gushi.org> AuthorDate: 2026-04-14 03:53:51 +0000 Commit: Cy Schubert <cy@FreeBSD.org> CommitDate: 2026-04-22 03:03:23 +0000 termcap: fix screen entry standout mode (so/se) capabilities so=\E[3m (italic) is incorrect, should be so=\E[7m (reverse video). se=\E[23m (italic off) is incorrect, should be se=\E[27m (reverse off). mr=\E[7m (reverse video) is correctly defined in the same entry. screen-256color inherits from screen via tc=screen and is fixed transitively. PR: 294499 Pull Request: https://github.com/freebsd/freebsd-src/pull/2139 MFC after: 1 week Signed-off-by: Dan Mahoney <freebsd@gushi.org> share/termcap/termcap | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Fix has bee committed. I will close this PR when it's been MFCed.
A commit in branch stable/15 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=7dcfbf4a8bf3553993569b3a3c5bca906e8f450a commit 7dcfbf4a8bf3553993569b3a3c5bca906e8f450a Author: Dan Mahoney <github@gushi.org> AuthorDate: 2026-04-14 03:53:51 +0000 Commit: Cy Schubert <cy@FreeBSD.org> CommitDate: 2026-04-28 14:19:25 +0000 termcap: fix screen entry standout mode (so/se) capabilities so=\E[3m (italic) is incorrect, should be so=\E[7m (reverse video). se=\E[23m (italic off) is incorrect, should be se=\E[27m (reverse off). mr=\E[7m (reverse video) is correctly defined in the same entry. screen-256color inherits from screen via tc=screen and is fixed transitively. PR: 294499 Pull Request: https://github.com/freebsd/freebsd-src/pull/2139 Signed-off-by: Dan Mahoney <freebsd@gushi.org> (cherry picked from commit 2bff747bb04db6beb19678abc45edd96be0a1347) share/termcap/termcap | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
A commit in branch stable/14 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=4c2563e16b401c31e82917476be1411422d6557e commit 4c2563e16b401c31e82917476be1411422d6557e Author: Dan Mahoney <github@gushi.org> AuthorDate: 2026-04-14 03:53:51 +0000 Commit: Cy Schubert <cy@FreeBSD.org> CommitDate: 2026-04-28 14:19:48 +0000 termcap: fix screen entry standout mode (so/se) capabilities so=\E[3m (italic) is incorrect, should be so=\E[7m (reverse video). se=\E[23m (italic off) is incorrect, should be se=\E[27m (reverse off). mr=\E[7m (reverse video) is correctly defined in the same entry. screen-256color inherits from screen via tc=screen and is fixed transitively. PR: 294499 Pull Request: https://github.com/freebsd/freebsd-src/pull/2139 Signed-off-by: Dan Mahoney <freebsd@gushi.org> (cherry picked from commit 2bff747bb04db6beb19678abc45edd96be0a1347) share/termcap/termcap | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
A commit in branch stable/13 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=2a32297a6d9f0c82e64d315239693fcf4bc7bc23 commit 2a32297a6d9f0c82e64d315239693fcf4bc7bc23 Author: Dan Mahoney <github@gushi.org> AuthorDate: 2026-04-14 03:53:51 +0000 Commit: Cy Schubert <cy@FreeBSD.org> CommitDate: 2026-04-28 14:20:05 +0000 termcap: fix screen entry standout mode (so/se) capabilities so=\E[3m (italic) is incorrect, should be so=\E[7m (reverse video). se=\E[23m (italic off) is incorrect, should be se=\E[27m (reverse off). mr=\E[7m (reverse video) is correctly defined in the same entry. screen-256color inherits from screen via tc=screen and is fixed transitively. PR: 294499 Pull Request: https://github.com/freebsd/freebsd-src/pull/2139 Signed-off-by: Dan Mahoney <freebsd@gushi.org> (cherry picked from commit 2bff747bb04db6beb19678abc45edd96be0a1347) share/termcap/termcap | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
This can be closed now.