diff --git a/infra/bin/fly-shadow-run b/infra/bin/fly-shadow-run index 4635e39..dc7fd03 100755 --- a/infra/bin/fly-shadow-run +++ b/infra/bin/fly-shadow-run @@ -549,11 +549,20 @@ PY exit 1 fi [ -x "$BIN" ] || die "$BIN is missing" - # The live service's configuration, for its compatibility string. - set -a - # shellcheck disable=SC1090,SC1091 - . "${FLY_ENV_FILE:-/etc/fly/fly.env}" - set +a + # The live service's configuration, for its compatibility string. fly.env is systemd's + # EnvironmentFile syntax (GAME_TITLE=Pokemon Red is valid there), so it is read as KEY=VALUE + # lines, as fly-runtime does, never sourced as shell. + local line key value env_file="${FLY_ENV_FILE:-/etc/fly/fly.env}" + if [ -f "$env_file" ]; then + while IFS= read -r line || [ -n "$line" ]; do + [[ "$line" =~ ^[A-Za-z_][A-Za-z0-9_]*= ]] || continue + key="${line%%=*}" + value="${line#*=}" + value="${value%\"}" + value="${value#\"}" + export "${key}=${value}" + done <"$env_file" + fi # The release CUT-01 switches into and the binary it switches to: SERVE-01's service there. "$BIN" check --verdict "$SHADOW_DIR/verdict.json" --current "${FLY_CURRENT_DIR:-/opt/fly/current}" \ --binary flysim-session "$@" diff --git a/infra/tests/lint.sh b/infra/tests/lint.sh index cc2a776..b4168cc 100755 --- a/infra/tests/lint.sh +++ b/infra/tests/lint.sh @@ -2355,6 +2355,16 @@ else fail "loop recovery tests failed; run python3 -m unittest discover -s infra/tests -p test_loop_recover.py -v" fi +echo "--- fly.env is read, never sourced ---" +# fly.env is systemd EnvironmentFile syntax: GAME_TITLE=Pokemon Red is valid there and a shell +# error when sourced (the v0.7.3 cutover's check died on it). Scripts parse KEY=VALUE lines. +sourced="$(grep -n -E '^[[:space:]]*(\.|source)[[:space:]]+.*(fly\.env|FLY_ENV_FILE)' "$REPO_ROOT"/infra/bin/* 2>/dev/null || true)" +if [ -z "$sourced" ]; then + pass "no infra/bin script sources fly.env" +else + fail "fly.env sourced as shell (parse KEY=VALUE lines instead): $sourced" +fi + echo "===" if [ "$FAILED" -eq 0 ]; then echo "lint.sh: ALL CHECKS PASSED"