Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

fix(dev): preserve executable launchd wrapper mode

pulse-triage[bot]ec25ab4c1360
diff --git a/scripts/dev-launchd-setup.sh b/scripts/dev-launchd-setup.sh
index 8f4469a8bb..6254d517b0 100755
--- a/scripts/dev-launchd-setup.sh
+++ b/scripts/dev-launchd-setup.sh
@@ -43,8 +43,12 @@ install() {
exit 1
fi
- # Make wrapper executable
- chmod +x "${SCRIPT_DIR}/dev-launchd-wrapper.sh"
+ # Preserve read-only/shared checkouts when Git already supplied the
+ # executable bit. Some development hosts allow group content writes but
+ # reserve mode changes for the file owner.
+ if [[ ! -x "${SCRIPT_DIR}/dev-launchd-wrapper.sh" ]]; then
+ chmod +x "${SCRIPT_DIR}/dev-launchd-wrapper.sh"
+ fi
# Create log directory
mkdir -p "${LOG_DIR}"
diff --git a/scripts/tests/test-hot-dev-bg.sh b/scripts/tests/test-hot-dev-bg.sh
index b40935f4dd..9b1b5fbb68 100755
--- a/scripts/tests/test-hot-dev-bg.sh
+++ b/scripts/tests/test-hot-dev-bg.sh
@@ -500,7 +500,7 @@ test_launchd_wrapper_uses_managed_supervisor() {
}
test_launchd_setup_advertises_managed_runtime_controls() {
- local test_dir fake_bin output
+ local test_dir fake_bin output chmod_calls
test_dir="$(mktemp -d)"
temp_dirs+=("${test_dir}")
fake_bin="${test_dir}/bin"
@@ -528,12 +528,27 @@ esac
EOF
chmod +x "${fake_bin}/launchctl"
+ cat > "${fake_bin}/chmod" <<'EOF'
+#!/usr/bin/env bash
+set -euo pipefail
+printf '%s\n' "$*" >> "${CHMOD_LOG}"
+if [[ "$*" == *"dev-launchd-wrapper.sh"* ]]; then
+ echo "setup attempted to mutate executable wrapper permissions" >&2
+ exit 97
+fi
+exec /bin/chmod "$@"
+EOF
+ chmod +x "${fake_bin}/chmod"
+
output="$(
PATH="${fake_bin}:$PATH" \
HOME="${test_dir}/home" \
+ CHMOD_LOG="${test_dir}/chmod.log" \
"${DEV_LAUNCHD_SETUP}" install
)"
+ chmod_calls="$(cat "${test_dir}/chmod.log")"
+ assert_not_contains "launchd setup leaves an executable tracked wrapper untouched" "${chmod_calls}" "dev-launchd-wrapper.sh"
assert_contains "launchd setup shows browser entrypoint" "${output}" "http://127.0.0.1:5173"
assert_contains "launchd setup shows managed start command" "${output}" "npm run dev"
assert_contains "launchd setup shows managed restart command" "${output}" "npm run dev:restart"