NetBSD-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: www/gnuchess-book issue with NetBSD 11
> Date: Sat, 4 Oct 2025 23:19:39 +0000 (UTC)
> From: John Klos <john%klos.com@localhost>
>
> I've been running NetBSD 11 on a number of systems for the last month.
> I've noticed that games/gnuchess-book, which compiles fine on NetBSD 10,
> fails with:
>
> allocating 192MB ...
> 80000 games ...
> 90000 games ...
> 100000 games ...
> 110000 games ...
> 120000 games ...
> 130000 games ...
> 140000 games ...
> ctype(3) isspace: invalid input: 256
> *** Signal 6
>
> It doesn't matter if I ulimit / unlimit beforehand. Is this a NetBSD 11
> issue?
This is an upstream bug.
Upstream is passing the number 256 into isspace(3), but the domain of
isspace(3) is only {EOF, 0, 1, 2, 3, ..., 255} -- that is, either EOF
(on NetBSD, -1), or those values of int which are representable by
unsigned char (on NetBSD, uint8_t). Passing any other argument, like
-2 or 256, leads to undefined behaviour.
See https://man.NetBSD.org/ctype.3#CAVEATS and C99/C11/C23 Sec. 7.4
`Character handling <ctype.h>' for details.
What's new in NetBSD 11 is that it detects these bugs more noisily: it
traps them with SIGSEGV or SIGABRT, rather than just giving nonsense
answers that are a huge pain to diagnose the downstream consequences
of, like a TNF financial report that is a slightly nondeterministic
function of perfectly sensible and unchanging financial records.
As of Wednesday, in both HEAD and netbsd-11, you can set the
environment variable LIBC_ALLOWCTYPEABUSE if you want this abuse of
the ctype(3) functions to lead to reading whatever random stuff
happens to be in memory instead of SIGABRT. Might lead to SIGSEGV,
might lead to nonsense answers -- but it will skip explicitly raising
SIGABRT inside the ctype(3) functions.
But I recommend you get a stack trace and forward this upstream.
Home |
Main Index |
Thread Index |
Old Index