aboutsummaryrefslogtreecommitdiff
path: root/scripts/theme-studio
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-06-10 10:07:32 -0500
committerCraig Jennings <c@cjennings.net>2026-06-10 10:07:32 -0500
commit35ab8419486cd8823fcced67bb6bc5a70a9d11fa (patch)
tree8ab48f25ccf472e347e2c61cc2f8d7c65fcced2d /scripts/theme-studio
parent4e12ba42c0374ce6c6275f6a6dd359c6ba3e2239 (diff)
downloaddotemacs-35ab8419486cd8823fcced67bb6bc5a70a9d11fa.tar.gz
dotemacs-35ab8419486cd8823fcced67bb6bc5a70a9d11fa.zip
fix(theme-studio): guard Chrome profile dir and bound headless renders
A headless render with an empty --user-data-dir falls back to the real Chrome profile and takes its SingletonLock. A hung render held that lock for 18 hours on 2026-06-09, blocking every interactive Chrome launch. The runner now refuses to run the browser gates when mktemp fails, and each render runs under timeout --kill-after so a wedged Chrome dies in seconds.
Diffstat (limited to 'scripts/theme-studio')
-rwxr-xr-xscripts/theme-studio/run-tests.sh7
1 files changed, 5 insertions, 2 deletions
diff --git a/scripts/theme-studio/run-tests.sh b/scripts/theme-studio/run-tests.sh
index 2f46602c8..c8e34fe99 100755
--- a/scripts/theme-studio/run-tests.sh
+++ b/scripts/theme-studio/run-tests.sh
@@ -59,11 +59,14 @@ if [ "$NO_BROWSER" = 1 ]; then
elif [ -z "$CHROME" ]; then
for t in $HASHES; do skip_msg "#$t (no Chromium-family browser found)"; done
else
- PROF="$(mktemp -d)"
+ # An empty --user-data-dir makes Chrome fall back to the user's real default
+ # profile and take its SingletonLock; a hung headless render then blocks every
+ # interactive Chrome launch until killed. Never let an empty PROF reach Chrome.
+ PROF="$(mktemp -d)" && [ -n "$PROF" ] || { echo "mktemp -d failed — refusing to run browser gates" >&2; exit 1; }
trap 'rm -rf "$PROF"' EXIT
for t in $HASHES; do
upper="$(echo "$t" | tr '[:lower:]' '[:upper:]')"
- res="$("$CHROME" --headless --no-sandbox --disable-gpu --user-data-dir="$PROF" \
+ res="$(timeout --kill-after=5 30 "$CHROME" --headless --no-sandbox --disable-gpu --user-data-dir="$PROF" \
--virtual-time-budget=8000 --dump-dom "file://$HERE/theme-studio.html#$t" 2>/dev/null \
| grep -o "${upper}[^<]*" | head -1)"
case "$res" in