From 8990a72bd7acb3933dc53887679fe01de96fa853 Mon Sep 17 00:00:00 2001 From: casjay Date: Wed, 5 Aug 2026 01:50:16 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20=5F=5Frandom=5Fpassword=20?= =?UTF-8?q?SIGPIPE=20abort=20under=20pipefail=20=F0=9F=90=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit App-breaking bug found during full runtime verification of the act_runner cache-server feature: `__random_password()`'s `tr | head -c` pipeline could be killed by SIGPIPE once `head -c` closes its input early, and under `set -eo pipefail` this aborted the whole script. - rootfs/usr/local/etc/docker/functions/entrypoint.sh: wrapped the `tr -dc ... | head -c...` pipeline in `{ ... } || true` so a SIGPIPE from `head` closing early no longer aborts the script - TODO.AI.md: logged the fix and the upstream-template-sync follow-up --- TODO.AI.md | 8 ++++++++ rootfs/usr/local/etc/docker/functions/entrypoint.sh | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/TODO.AI.md b/TODO.AI.md index 99c0fe2..a8b09f8 100644 --- a/TODO.AI.md +++ b/TODO.AI.md @@ -21,6 +21,14 @@ Update Runbook in AI.md — `functions/entrypoint.sh` is normally regenerated, n (the default). This was the root cause of the container dying immediately after printing only the startup banner. Fixed by appending `|| true` to all 26 occurrences. +## App-breaking bug fixed — __random_password() SIGPIPE (functions/entrypoint.sh) + +Needs syncing back to the upstream template in `casjay-dotfiles/scripts` per the Docker Template +Update Runbook in AI.md — `functions/entrypoint.sh` is normally regenerated, not hand-edited. + +- `__random_password()` (~line 333): `tr | head -c` pipeline died under `set -eo pipefail` on + SIGPIPE. Fixed by wrapping in `{ ... } || true`. + ## Other observations not yet actioned - `.gitea/workflows/docker.yaml` uses the same stale/unpinned action pattern (`@v2`-`@v4`, DockerHub-only, `catthehacker/ubuntu:act-latest`) that was removed from the `opengist` repo's duplicate workflow — no `build.yml` counterpart exists here yet. diff --git a/rootfs/usr/local/etc/docker/functions/entrypoint.sh b/rootfs/usr/local/etc/docker/functions/entrypoint.sh index b5b8627..738315a 100644 --- a/rootfs/usr/local/etc/docker/functions/entrypoint.sh +++ b/rootfs/usr/local/etc/docker/functions/entrypoint.sh @@ -330,7 +330,7 @@ __find_mongodb_conf() { find -L '/etc/mongodb' '/etc' -maxdepth 4 -type f \( -name 'mongod.conf' -o -name 'mongodb.conf' \) 2>/dev/null | head -n1 } # - - - - - - - - - - - - - - - - - - - - - - - - - -__random_password() { tr -dc '0-9a-zA-Z' < /dev/urandom | head -c${1:-16} && echo ""; } +__random_password() { { tr -dc '0-9a-zA-Z' < /dev/urandom | head -c"${1:-16}"; } || true; echo ""; } # - - - - - - - - - - - - - - - - - - - - - - - - - __init_working_dir() { # get service name