Files
firmware/pkgs
Oleksandr ShyshatskyiandClaude Opus 5 39710c0f02 s6-rc needs a finite deadline on a 32-bit time_t
s6-rc-init and s6-rc default to TAIN_INFINITE_RELATIVE. skalibs converts a
deadline to a struct timeval before select(), and infinity does not fit a
32-bit time_t: the call fails immediately with EOVERFLOW -- "Value too large
for defined data type" -- before a single service is touched. Passing -t fixes
it, in firmwareExe, start.sh and klipperDaemon.

WHY IT APPEARED NOW. qa-suite-bridgehead built the supervision stack with the
Bootlin musl toolchain, and musl has a 64-bit time_t on every architecture.
pkgs/lib.sh states the rule this repo actually follows -- "ONE TOOLCHAIN:
everything here cross-compiles with the Ingenic glibc 2.29 / gcc 7.2
toolchain" -- and glibc 2.29 on mips32 does not. So the bug was latent in the
graph and became visible the moment s6 became a recipe like everything else.
Fixing it in the callers keeps one libc, which is the point of that rule.

HOW IT WAS FOUND, because three plausible answers were wrong first. Not the
filesystem: it failed identically with the live dir on /usr/data and on /run.
Not the database: s6-rc-db read it fine, and a database recompiled inside the
replica by the target compiler failed the same way. Not a missing
-D_FILE_OFFSET_BITS=64: both s6-svscan and s6-rc-init reference readdir64 and
never plain readdir -- and s6-svscan supervises a NON-empty scandir on both
filesystems, which is the test that had been missing (it had only ever been
started on an empty one). qemu's own strace then showed no failing syscall at
all, which is what pointed at a deadline computed in userspace.

The boot now reaches the transition: the scanner comes up, s6-rc-init lays
down all seven servicedirs and links them, and s6-rc starts wifi, nginx and
moonraker. qa/replica/test_s6rc.py still fails, for an environmental reason
that is not this bug: the replica creates null, zero, full, random, urandom,
tty and fb0 and no ttyS*, so mcu-bringup cannot reach the toolhead boards,
klipper never starts, and the ok-all bundle never comes up.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VpUmBb4xtmnmtTosonqeNi
2026-08-29 19:48:02 +03:00
..