diff options
| author | Paul Buetow <paul@buetow.org> | 2026-07-02 00:53:24 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-07-02 00:53:24 +0300 |
| commit | 58602a28d2c92b603208f3e01c14c169d28cc7b0 (patch) | |
| tree | 502d2e187ea29f2cc840e22d299d752d59088a3c /yhttpd/configure | |
| parent | 6c3a65b577f002f3219d03498c66205434765179 (diff) | |
yhttpd: port ychat fixes, get it building + stable in Docker (task 9s0)
Ports the ychat revival fixes (unsigned/size_t npos truncation, ofstream
== NULL, tool::trim OOB, CGI popen -> execve, www.yChat.org links, g++
version gate, config.pl -I., NCURSES/CLI-disabled build) so yhttpd builds
on modern GCC in a Rocky Linux 9 container, plus yhttpd-specific fixes
found while verifying it under concurrent load:
- listen() backlog was hardcoded to 1; bumped to SOMAXCONN.
- sock::_close() closed sockets with unread request bytes still in the
kernel receive buffer (read_http() only reads the GET line), so Linux
sent an abortive RST instead of a FIN, racing the client's read of the
response ("connection reset by peer" even though it was delivered).
Fixed with a non-blocking, bounded drain before close() - confirmed via
tcpdump: RSTs on every response before, zero after, across 140+
requests / concurrent bursts of 20.
- Removed a duplicate _make_server_socket() call in start() (wrap.cpp's
init_wrapper() already makes it before start() runs) that leaked a fd
and would have double-initialized SSL if OPENSSL is ever enabled;
caught by fresh-context review, documented honestly in DOCKER.md.
- src/configure's dependency-checker predates 64-bit multilib distros
(only checked /usr/lib, never /usr/lib64) and was missing an ncur
move-aside entry for the NCURSES-disabled build.
Added Dockerfile/.dockerignore/DOCKER.md documenting the build, the fixes,
and the one known-but-unfixed landmine (a SIGILL heap corruption in
sock::_close that reproduces on newer host GCC/glibc but not in the
container - latent, not fixed).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Diffstat (limited to 'yhttpd/configure')
| -rwxr-xr-x | yhttpd/configure | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/yhttpd/configure b/yhttpd/configure index 9aab971..56f015f 100755 --- a/yhttpd/configure +++ b/yhttpd/configure @@ -51,17 +51,25 @@ perl -e ' } &check_make; print "Checking compiler version\n"; - my $r = 0; - for (my $i = 4; $i > 0 && $r == 0; --$i ) { - $r = &check_gcc(3,$i); - } - if ($r == 0) { - print "No suitable g++ compiler found!\n"; - print "Please install a right version of GNU G++!\n"; + # Accept any GNU g++ (the original check only accepted g++ 3.x; modern GCC + # works fine with the legacy-C++ fixes applied). Write g++.version as + # "<version>\ng++\n" - src/configure reads the last line as the compiler. + my $ver = `g++ -dumpversion 2>/dev/null`; + chomp $ver; + if ( $ver eq "" ) { + print "No GNU g++ compiler found!\nPlease install GNU G++!\n"; exit(1); } - - system("perl \"scripts/config.pl\""); + `echo $ver > g++.version`; + `echo g++ >> g++.version`; + print "GNU G++ $ver found!\n"; + + # -I. : scripts/config.pl does "use scripts::modules::file", which needs + # "." on @INC. Perl 5.26+ dropped "." from the default @INC, so this + # silently BEGIN-failed on modern Perl (the "yes" answer was never even + # read - it happened to be harmless only because the committed glob.h + # defaults were already correct). + system("perl -I. \"scripts/config.pl\""); chdir("src"); system("./configure ".join(" ", @ARGV)); chdir(".."); |
