The package builds, but then fails with an error before installing.
The python-langgraph 1.2.3-1 AUR package would fail to build on a fresh run because the check() function has a stale-process conflict:
Stale Postgres on port 5442 — If a previous makepkg was interrupted (Ctrl+C, timeout, crash), the postgres instance it started keeps running on port 5442. Next build attempt fails with pg_ctl: could not start server / could not bind address: Address already in use.
Evidence from the failed fresh build:
pg_ctl: could not start server
PostgreSQL log showed:
could not bind IPv4 address "127.0.0.1": Address already in use
FATAL: could not create any TCP/IP sockets
Trap only handled redis — The trap 'pkill redis-server' EXIT only cleaned up redis, NOT postgres. If the build was interrupted during the
~35-second test suite, the postgres process leaked.
Redis unconditionally started on port 6379 — If port 6379 was already in use (which it was on this machine), redis-server would fail to start.
Tests still pass (they skip redis-specific tests), but it generates confusing error output.
Fix:
# 1. Stale-process cleanup: before starting postgres, check port 5442 with fuser
stale_pid=$(fuser 5442/tcp 2>/dev/null | awk '{print $1}')
if [ -n "$stale_pid" ]; then
kill "$stale_pid" 2>/dev/null || true
sleep 1
fi
# 2. Expanded trap cleanup on EXIT/INT/TERM for BOTH postgres and redis
trap cleanup EXIT INT TERM
# 3. Redis only starts if port 6379 is free
if ! fuser 6379/tcp >/dev/null 2>&1; then
redis-server ...
fi
The package builds, but then fails with an error before installing.
The python-langgraph 1.2.3-1 AUR package would fail to build on a fresh run because the check() function has a stale-process conflict:
Evidence from the failed fresh build:
~35-second test suite, the postgres process leaked.
Tests still pass (they skip redis-specific tests), but it generates confusing error output. Fix: