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
commit147ad3dac5f39922198164efb91cddc2c8f4bc62 (patch)
treed4685bbaa8d63bf2f88a2514b63fa0d13e3bb9c5 /scripts/theme-studio
parenteea44935b4e7bc322a415840119fc63162f5ad81 (diff)
downloaddotemacs-147ad3dac5f39922198164efb91cddc2c8f4bc62.tar.gz
dotemacs-147ad3dac5f39922198164efb91cddc2c8f4bc62.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 2f46602c..c8e34fe9 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