🐛 Fix container restart loop from set -e propagation 🐛
Build and Push / build (push) Failing after 1s
opengist / release-opengist (push) Failing after 53s

Root cause: many functions in functions/entrypoint.sh ended with a bare,
unguarded `[ "$DEBUGGER" = "on" ] && echo/printf/__service_banner ...`
statement as their last executed line. With DEBUGGER unset (the default
runtime case), the `[ ]` test is false, so the function's implicit
return value is nonzero. Several of these functions (most critically
__symlink, called bare from __setup_mta) are invoked as unguarded
statements from other functions, and the whole entrypoint runs under
`set -eo pipefail`, so the nonzero return aborted the entire script
chain immediately after startup — explaining why the container only
printed the first log line and exited 1, and why it only worked with
DEBUGGER=on (which makes the echo run and return 0, masking the bug).

Verified via two clean docker buildx build + run cycles: before the
fix, `docker inspect` showed the container crash-looping (exit 1,
~3.9s uptime); after, `RestartCount=0 Status=running Health=healthy`
with opengist fully started, DEBUGGER unset.

- rootfs/usr/local/etc/docker/functions/entrypoint.sh: append `|| true`
  to all 26 bare `[ "$DEBUGGER" = "on" ] && ...` statements so their
  result never propagates as the enclosing function's return value
- TODO.AI.md: log 20 pre-existing script-lint findings on the same
  file (missing `--` on grep, missing `local` on a few function-local
  vars, missing VERSION= line) found incidentally while diagnosing
  this bug; deferred as unrelated cleanup, not part of this fix
This commit is contained in:
2026-08-03 09:41:46 -04:00
parent 32f2d90bb6
commit b016f1db1d
3 changed files with 835 additions and 26 deletions
+14
View File
@@ -0,0 +1,14 @@
# TODO.AI.md
Pre-existing script-lint findings on `rootfs/usr/local/etc/docker/functions/entrypoint.sh`,
found while fixing the container restart-loop bug. Not caused by that fix; deferred here
since they are unrelated cleanup, not a functional regression.
- [ ] `grep` calls missing `--` before the pattern (lines 80, 92, 111, 141, 169, 685, 741,
751, 812, 855, 901, 912, 936) — add `--` per `~/.claude/memory/tool_conventions.md`
- [ ] `__fix_permissions()` (line 737-738): `change_user`/`change_group` assigned without `local`
- [ ] `__initialize_db_users()` (lines 1370-1373): `db_normal_user`, `db_normal_pass`,
`db_admin_user`, `db_admin_pass` assigned without `local`
- [ ] `__initialize_custom_bin_dir()` (line 1416): `create_bin_name` assigned without `local`
- [ ] No `VERSION=` assignment in body to match the `##@Version` header (functions library —
confirm whether versioning is required for this file type before adding)