fix(restore-drill): chown extracted scratch tree so fsck actually runs #5507
1 changed file+9−1
Modifiedscripts/restore-drill.sh+9−1View fileUnifiedSplit
@@ -294,6 +294,14 @@ else
294294 log "FAIL repos: tar -xzf failed: $(head -c 300 "$WORK/tar.err" | tr '\n' ' ')"
295295 fails=$((fails + 1))
296296 else
297 # Root extracting a tarball restores the ARCHIVED owners (the container
298 # UID that wrote the repos), and git then refuses every one of them with
299 # "detected dubious ownership" before fsck runs at all — the 2026-08-20
300 # drill failed all 48 repos this way. Re-own the scratch tree to whoever
301 # is running the drill (a no-op when tar already extracted as us), and
302 # belt-and-braces the fsck with safe.directory for git versions where a
303 # stray root-owned file survives the chown.
304 chown -R "$(id -u):$(id -g)" "$extract" 2>/dev/null || true
297305 # Bare repos live at <root>/<owner>/<name>.git. Scratch trees the app keeps
298306 # under dot-directories (.stage-previews, .ship-agent-worktrees, …) are
299307 # not repos and are skipped. Each match is pruned so nothing inside a
@@ -303,7 +311,7 @@ else
303311 repos_found="$(grep -c . "$repo_list" || true)"
304312 while IFS= read -r repo; do
305313 [ -n "$repo" ] || continue
306 if ! git -C "$repo" fsck --connectivity-only >/dev/null 2>"$WORK/fsck.err"; then
314 if ! git -c safe.directory='*' -C "$repo" fsck --connectivity-only >/dev/null 2>"$WORK/fsck.err"; then
307315 repos_bad=$((repos_bad + 1))
308316 log "FAIL repo: fsck failed for ${repo#"$extract"/}: $(head -c 200 "$WORK/fsck.err" | tr '\n' ' ')"
309317 fi
310318
c comment · e edit title · m merge · a approve · r request changes · ? shortcuts