mirror of
https://github.com/gesellix/Bose-SoundTouch.git
synced 2026-08-19 09:06:14 +00:00
Three stacked bugs, found and confirmed on real hardware while downgrading a speaker: the new binary landed on disk correctly, but the running service kept reporting the old version indefinitely. - install.sh called `/etc/init.d/aftertouch start`, not `restart`, after installing. start-stop-daemon silently refuses to launch a second instance when one is already running, and the init script never checked its exit status, so the old process was never replaced. - The init script started the daemon through a `sh -c "exec ... | logger"` pipeline, on the assumption that `exec` lets --make-pidfile record the daemon's own PID. POSIX forks each side of a pipe into its own process, so the wrapper shell (not the daemon) was the one actually tracked. `stop` killed the wrapper, which doesn't forward SIGTERM to its children, orphaning the real daemon to keep running and keep holding :8000 forever. - Once the wrapper correctly tracked the daemon's own PID, a further race surfaced: start-stop-daemon's own "already running?" check matched on generic `/bin/sh` identity, so a `restart`'s `start` phase could catch the previous wrapper still mid-teardown and silently refuse to launch a new one (masked by --quiet, looking like a 120s hang). Fixed by calling `restart` instead of `start` in install.sh, and by having the wrapper shell record the daemon's real PID itself (via $!) while keying start-stop-daemon's own check on that same pidfile instead of process identity. Verified on hardware: three consecutive restart cycles, each fast, each with the pidfile matching the live daemon PID and daemon output flowing through syslog again via logread. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>