From 1691204bbd58db767879e463e78527480f4cb559 Mon Sep 17 00:00:00 2001 From: SPANISH FLU Date: Fri, 30 Jan 2026 08:27:40 +0100 Subject: [PATCH] fix: prevent postinstall infinite loop on bun install The postinstall script was spawning hundreds of electron-builder processes in an infinite loop. This happened because: 1. postinstall runs `bun run --filter=@superset/desktop install:deps` 2. install:deps runs `electron-builder install-app-deps` 3. electron-builder triggers nested bun installs 4. Those installs re-trigger postinstall, repeating the cycle This fix adds an environment variable guard to detect and prevent recursive postinstall invocations. Fixes #1063 Co-Authored-By: Claude Opus 4.5 --- package.json | 2 +- scripts/postinstall.sh | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100755 scripts/postinstall.sh diff --git a/package.json b/package.json index a525cd015d4..d5e13060981 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "format:check": "biome format .", "typecheck": "turbo typecheck", "ui-add": "turbo run ui-add", - "postinstall": "sherif; bun run --filter=@superset/desktop install:deps", + "postinstall": "./scripts/postinstall.sh", "clean": "git clean -xdf node_modules", "clean:workspaces": "turbo clean", "release:desktop": "./apps/desktop/create-release.sh", diff --git a/scripts/postinstall.sh b/scripts/postinstall.sh new file mode 100755 index 00000000000..de2a60239a2 --- /dev/null +++ b/scripts/postinstall.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# Prevent infinite recursion during postinstall +# electron-builder install-app-deps can trigger nested bun installs +# which would re-run postinstall, spawning hundreds of processes + +if [ -n "$SUPERSET_POSTINSTALL_RUNNING" ]; then + exit 0 +fi + +export SUPERSET_POSTINSTALL_RUNNING=1 + +# Run sherif for workspace validation +sherif + +# Install native dependencies for desktop app +bun run --filter=@superset/desktop install:deps