mirror of
https://github.com/akitaonrails/ai-memory.git
synced 2026-10-02 03:24:46 +08:00
Follow-up to #51 fixing two defects the merged diff introduced: 1. Linux silently lost `-u`. The case had `Linux)`, `Darwin)`, `*)` but only Darwin and the catch-all assigned USER_ARGS, so Linux fell through with the pre-case `USER_ARGS=()` default and ran the container as its internal uid 1000. Regressing for any Linux user with a non-1000 host UID or a bind-mounted `AI_MEMORY_DATA_DIR`. Fix: invert the default — USER_ARGS=(-u $(id -u):$(id -g)) at the top, then only Darwin overrides to (). Eliminates the Linux/`*` duplication too. 2. "${USER_ARGS[@]}" was not guarded for set -u. The PR carefully applied ${arr[@]+"${arr[@]}"} to TTY_ARGS / NETWORK_ARGS / ENV_ARGS for set-u compat on macOS's default /bin/bash 3.2 — but the new USER_ARGS line used the plain quoted form, which re-hits the exact same unbound-variable crash on Darwin (where USER_ARGS is empty by design). Fix: use the same ${USER_ARGS[@]+"${USER_ARGS[@]}"} pattern as the surrounding arrays. Verified via simulated case-arm expansion: Linux → `-u 1026:1026`, Darwin → empty (no `-u`), other (FreeBSD/etc.) → `-u 1026:1026`. `bash -n` clean.