|
#!/usr/bin/env bash |
|
# Reproduction script for: |
|
# [Bug] Helper app lookup uses hardcoded "Electron Helper" name |
|
# Tested on: macOS 26.5 (Darwin 25.5.0), arm64, Electron 42.2.0 |
|
# |
|
# Requirements: Node.js, pnpm (or npm/yarn) |
|
# |
|
# Run: bash reproduce.sh |
|
|
|
set -e |
|
|
|
ELECTRON_VERSION="42.2.0" |
|
WORK_DIR="$(mktemp -d)" |
|
echo "Working in $WORK_DIR" |
|
|
|
# 1. Install Electron locally |
|
cd "$WORK_DIR" |
|
cat > package.json <<'JSON' |
|
{ "name": "repro", "version": "1.0.0", "devDependencies": { "electron": "42.2.0" } } |
|
JSON |
|
npm install --silent |
|
|
|
ELECTRON_APP="node_modules/electron/dist/Electron.app" |
|
|
|
# 2. Verify the app works as-is (helpers still named "Electron Helper") |
|
echo "" |
|
echo "=== Step 1: launching with original helper names (should NOT crash) ===" |
|
xattr -dr com.apple.quarantine "$ELECTRON_APP" 2>/dev/null || true |
|
timeout 4 "$ELECTRON_APP/Contents/MacOS/Electron" --no-sandbox 2>&1 || true |
|
echo "→ OK, no crash" |
|
|
|
# 3. Copy the app and rename helpers (simulate what electron-builder does) |
|
cp -R "$ELECTRON_APP" "$WORK_DIR/TestApp.app" |
|
FRAMEWORKS="$WORK_DIR/TestApp.app/Contents/Frameworks" |
|
|
|
for SUFFIX in "" " (GPU)" " (Plugin)" " (Renderer)"; do |
|
SRC="$FRAMEWORKS/Electron Helper${SUFFIX}.app" |
|
DST="$FRAMEWORKS/TestApp Helper${SUFFIX}.app" |
|
if [ -d "$SRC" ]; then |
|
mv "$SRC" "$DST" |
|
mv "$DST/Contents/MacOS/Electron Helper${SUFFIX}" \ |
|
"$DST/Contents/MacOS/TestApp Helper${SUFFIX}" 2>/dev/null || true |
|
fi |
|
done |
|
|
|
xattr -dr com.apple.quarantine "$WORK_DIR/TestApp.app" 2>/dev/null || true |
|
|
|
# 4. Launch with renamed helpers — should crash |
|
echo "" |
|
echo "=== Step 2: launching with renamed helpers (SHOULD crash with exit 133) ===" |
|
"$WORK_DIR/TestApp.app/Contents/MacOS/Electron" |
|
EXIT_CODE=$? |
|
echo "Exit code: $EXIT_CODE" |
|
|
|
if [ "$EXIT_CODE" -eq 133 ]; then |
|
echo "✓ Reproduced: exit 133 (SIGTRAP) — Unable to find helper app" |
|
else |
|
echo "✗ Could not reproduce on this system (exit $EXIT_CODE)" |
|
fi |