Created attachment 261063 [details] git diff for lib/ncurses/tinfo/ncurses_cfg.h On freebsd-current and 14.2-RELEASE, ports/games/nethack34 remains garbage characters on the tty interface. The x11 interface has not affected. games/nethack{32,33}* and japanese/nethack34 has the same problem. games/nethack36 has not affected. The other nethack variants has not tested. * How to repeat (e.g. games/nethack34, Ranger-elf-male) | | | ------------- | |..{....d...| | ------ ##............| | +....| # |..........@| | |.....##### |...........| | |....| -.----------- | |....| | |<...| | |....| | ------ | | Nabe the Tenderfoot St:15 Dx:10 Co:12 In:15 Wi:13 Ch:8 Chaotic | Dlvl:1 $:16 HP:14(14) Pw:3(3) AC:7 Exp:1 When I hit 'f' to shoot allows, the screen becomes corrupted: | You shoot 3 elven arrows. | | ------------- | |..{....d...| . | ------ ##............| | +....| # |.......d.)))))))..50 | |.....##### |...........| | |....| -.----------- | |....| | |<...| | |....| | ------ | | Nabe the Tenderfoot St:15 Dx:10 Co:12 In:15 Wi:13 Ch:8 Chaotic | Dlvl:1 $:16 HP:14(14) Pw:3(3) AC:7 Exp:1 Then if I hit '^R' to redraw the screen, it becomes normally: | | | ------------- | |..{........| | ------ ##............| | +....| # |..)....d..@| | |.....##### |...........| | |....| -.----------- | |....| | |<...| | |....| | ------ | | Nabe the Tenderfoot St:15 Dx:10 Co:12 In:15 Wi:13 Ch:8 Chaotic | Dlvl:1 $:16 HP:14(14) Pw:3(3) AC:7 Exp:1 * Workaround If I build games/nethack34 with not system ncurses but devel/ncurses, the problem has gone. * How to fix It is caused by the code in tty_delay_output()@nethack-3.4.3/win/tty/termcap.c like this: > tputs("50", 1, xputc); Described in BUGS section in curs_termcap(3X), it is interpreted as busy-wait for 50 msec by termcap. On ncurses these interpretation is enabled with adding '--enable-bsdpad' argument to the configure script. devel/ncurses has built with the option. In June, 2024, ncurses-6.5 is imported to the FreeBSD main branch and stable/14 branch. And then committed "ncurses: reinstantiate bsd specific code" to the both branch: https://cgit.freebsd.org/src/commit/lib/ncurses/tinfo/ncurses_cfg.h?id=e402155e1ad7ec92a1fbd1712ce86c2ca43e1823 > diff --git a/lib/ncurses/tinfo/ncurses_cfg.h b/lib/ncurses/tinfo/ncurses_cfg.h > index ced59c68e93c..33890f300310 100644 > --- a/lib/ncurses/tinfo/ncurses_cfg.h > +++ b/lib/ncurses/tinfo/ncurses_cfg.h > @@ -60,6 +60,9 @@ > #define HAVE_LONG_FILE_NAMES 1 > #define MIXEDCASE_FILENAMES 1 > #define STDC_HEADERS 1 > +#define USE_GETCAP 1 > +#define USE_BSD_TPUTS 1 > +#define HAVE_BSD_CGETENT 1 > #define HAVE_SYS_TYPES_H 1 > #define HAVE_SYS_STAT_H 1 > #define HAVE_STDLIB_H 1 Unfortunately, on ncurses-6.5 '--enable-bsdpad' defines not USE_BSD_TPUTS but BSD_TPUTS. The other two defines seems correct. After apply the attached patch and rebuild the system, games/nethack34 (and others) works correctly in the tty interface. The patch has tested on freebsd-current and 14.2-RELEASE.
^Triage: set Patch flag in attachment, which obsoletes use of "[patch]" in Summary.
(In reply to WATANABE Kazuhiro from comment #0) > Unfortunately, on ncurses-6.5 '--enable-bsdpad' > defines not USE_BSD_TPUTS but BSD_TPUTS. The other > two defines seems correct. Indeed, the 3 lines added to ncurses_cfg.h in e402155 (2024-06-20) to "reinstantiate bsd specific code": > #define USE_GETCAP 1 > #define USE_BSD_TPUTS 1 > #define HAVE_BSD_CGETENT 1 had all been removed a few hours earlier in 2181799 when importing version 6.5, having previously been present since libtinfo was split from libncurses in 396851c (2021-10-04) ... except that USE_BSD_TPUTS is clearly a typo for the removed BSD_TPUTS. Easy to do immediately after typing USE_GETCAP! The other 2 are correct. See the file history at https://github.com/freebsd/freebsd-src/commits/main/lib/ncurses/tinfo/ncurses_cfg.h This is not specific to ncurses-6.5, it's been BSD_TPUTS (and also USE_GETCAP and HAVE_BSD_CGETENT) for over 25 years in https://github.com/freebsd/freebsd-src/commits/main/contrib/ncurses/include/ncurses_defs That Nethack functionality is referenced in the ncurses source at https://github.com/freebsd/freebsd-src/blob/main/contrib/ncurses/ncurses/tinfo/lib_tputs.c > 336 #if BSD_TPUTS > 337 /* > 338 * This ugly kluge deals with the fact that some ancient BSD programs > 339 * (like nethack) actually do the likes of tputs("50") to get delays. > 330 */ > ... So in ncurses_cfg.h it should definitely be > #define BSD_TPUTS 1
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=836a0d46320c18d83029bf138b630b6ce5ebe6ae commit 836a0d46320c18d83029bf138b630b6ce5ebe6ae Author: Baptiste Daroussin <bapt@FreeBSD.org> AuthorDate: 2025-12-05 10:18:48 +0000 Commit: Baptiste Daroussin <bapt@FreeBSD.org> CommitDate: 2025-12-05 10:24:58 +0000 ncurses: readd "bsdpads" During the import of ncurses 6.5 some bsd specifics configuration where lost and reintroduce quickly after the import, unfortunatly there was a typo in this fix which caused the "bsdpads" to not be enabled in ncurses. Fortunatly only very old programs may be affected by this change, unfortunatly Nethack (in the ports tree is one of them.) PR: 287358 MFC After: 3 days lib/ncurses/tinfo/ncurses_cfg.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
A commit in branch stable/15 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=5ba67163a3fcb2e4288f5116fa57c2b2758043d6 commit 5ba67163a3fcb2e4288f5116fa57c2b2758043d6 Author: Baptiste Daroussin <bapt@FreeBSD.org> AuthorDate: 2025-12-05 10:18:48 +0000 Commit: Baptiste Daroussin <bapt@FreeBSD.org> CommitDate: 2026-01-14 12:28:38 +0000 ncurses: readd "bsdpads" During the import of ncurses 6.5 some bsd specifics configuration where lost and reintroduce quickly after the import, unfortunatly there was a typo in this fix which caused the "bsdpads" to not be enabled in ncurses. Fortunatly only very old programs may be affected by this change, unfortunatly Nethack (in the ports tree is one of them.) PR: 287358 MFC After: 3 days (cherry picked from commit 836a0d46320c18d83029bf138b630b6ce5ebe6ae) lib/ncurses/tinfo/ncurses_cfg.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
A commit in branch stable/14 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=9b9ebc918a6782a717f8380d1d65572804a102a9 commit 9b9ebc918a6782a717f8380d1d65572804a102a9 Author: Baptiste Daroussin <bapt@FreeBSD.org> AuthorDate: 2025-12-05 10:18:48 +0000 Commit: Baptiste Daroussin <bapt@FreeBSD.org> CommitDate: 2026-01-14 12:28:53 +0000 ncurses: readd "bsdpads" During the import of ncurses 6.5 some bsd specifics configuration where lost and reintroduce quickly after the import, unfortunatly there was a typo in this fix which caused the "bsdpads" to not be enabled in ncurses. Fortunatly only very old programs may be affected by this change, unfortunatly Nethack (in the ports tree is one of them.) PR: 287358 MFC After: 3 days (cherry picked from commit 836a0d46320c18d83029bf138b630b6ce5ebe6ae) lib/ncurses/tinfo/ncurses_cfg.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Can this now be Closed FIXED?
done, thanks a lot for the report.