mirror of
https://github.com/obra/superpowers.git
synced 2026-08-19 00:01:02 +08:00
fix(sdd): invoke sdd-workspace via bash so helpers survive stripped exec bits
Codex marketplace users hit 'Permission denied' running SDD helpers:
some extractors (Python zipfile) discard Unix mode attributes when
unpacking the package, so task-brief's and review-package's direct exec
of their sibling sdd-workspace fails. Our packaging preserves 0755
(git archive | tar -xpf, asserted by the existing packaging test) — the
bits are lost on the consumer side, which no packaging change can reach.
Invoking the sibling via "${BASH:-bash}" makes the exec bit irrelevant.
TDD: new regression case copies the helpers, chmod -x, runs task-brief
via bash — RED with the reported rc=126 Permission denied, GREEN after.
Reported in #2040 (michaelholcomb-creator). Fixes #2040.
This commit is contained in:
@@ -25,7 +25,9 @@ git rev-parse --verify --quiet "$head" >/dev/null || { echo "bad HEAD: $head" >&
|
||||
if [ $# -eq 4 ]; then
|
||||
out=$4
|
||||
else
|
||||
dir=$("$(cd "$(dirname "$0")" && pwd)/sdd-workspace" "$plan")
|
||||
# Invoke via bash rather than direct exec: some extractors (Python zipfile)
|
||||
# strip Unix exec bits when unpacking marketplace packages (#2040).
|
||||
dir=$("${BASH:-bash}" "$(cd "$(dirname "$0")" && pwd)/sdd-workspace" "$plan")
|
||||
out="$dir/review-$(git rev-parse --short "$base")..$(git rev-parse --short "$head").diff"
|
||||
fi
|
||||
|
||||
|
||||
@@ -21,7 +21,9 @@ n=$2
|
||||
if [ $# -eq 3 ]; then
|
||||
out=$3
|
||||
else
|
||||
dir=$("$(cd "$(dirname "$0")" && pwd)/sdd-workspace" "$plan")
|
||||
# Invoke via bash rather than direct exec: some extractors (Python zipfile)
|
||||
# strip Unix exec bits when unpacking marketplace packages (#2040).
|
||||
dir=$("${BASH:-bash}" "$(cd "$(dirname "$0")" && pwd)/sdd-workspace" "$plan")
|
||||
out="$dir/task-${n}-brief.md"
|
||||
fi
|
||||
|
||||
|
||||
@@ -189,6 +189,21 @@ PLAN
|
||||
echo " status: $wt_status"
|
||||
fi
|
||||
|
||||
# --- helpers survive a mode-stripping extractor dropping exec bits (#2040) ---
|
||||
local stripped="$TEST_ROOT/stripped-scripts"
|
||||
mkdir -p "$stripped"
|
||||
cp "$SDD_SCRIPTS/sdd-workspace" "$SDD_SCRIPTS/task-brief" "$SDD_SCRIPTS/review-package" "$stripped/"
|
||||
chmod -x "$stripped"/*
|
||||
local noexec_out noexec_rc=0
|
||||
noexec_out="$(cd "$repo" && bash "$stripped/task-brief" plan-b.md 1 2>&1)" || noexec_rc=$?
|
||||
if [[ "$noexec_rc" -eq 0 && -f "$repo/.superpowers/sdd/plan-b/task-1-brief.md" ]]; then
|
||||
pass "task-brief works with no exec bit on sdd-workspace"
|
||||
else
|
||||
fail "task-brief works with no exec bit on sdd-workspace"
|
||||
echo " rc: $noexec_rc"
|
||||
echo " output: $noexec_out"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
if [[ "$FAILURES" -ne 0 ]]; then
|
||||
echo "FAILED: $FAILURES assertion(s)."
|
||||
|
||||
Reference in New Issue
Block a user