From ba9c21955a8e331484333f30a966d52f46ed6fb7 Mon Sep 17 00:00:00 2001 From: Mauricio Siu Date: Sun, 30 Aug 2026 16:42:25 -0600 Subject: [PATCH] fix: use a temp file instead of process substitution for POSIX sh compat MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The restore script runs under /bin/sh, not bash. Process substitution ("< <(...)") is a bashism dash doesn't support, so the previous fix failed at runtime with a syntax error and the restore never ran. Write STOPPED_CONTAINERS to a temp file and read the while loops from that instead — same effect, works under plain POSIX sh. --- packages/server/src/utils/volume-backups/restore.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/server/src/utils/volume-backups/restore.ts b/packages/server/src/utils/volume-backups/restore.ts index 382d9dfdc..13853f5f6 100644 --- a/packages/server/src/utils/volume-backups/restore.ts +++ b/packages/server/src/utils/volume-backups/restore.ts @@ -106,6 +106,11 @@ export const restoreVolume = async ( exit 1 fi + # Use a temp file instead of process substitution ("< <(...)") so this + # still works under a plain POSIX /bin/sh, not just bash. + STOPPED_CONTAINERS_FILE=$(mktemp) + printf '%s\\n' "$STOPPED_CONTAINERS" > "$STOPPED_CONTAINERS_FILE" + # Re-check each container's live state right before removing it: it may have # started running again since the "docker ps -a" snapshot above. ACTIVE_AGAIN="" @@ -116,9 +121,10 @@ export const restoreVolume = async ( ACTIVE_AGAIN="$ACTIVE_AGAIN $container_name" ;; esac - done < <(printf '%s\\n' "$STOPPED_CONTAINERS") + done < "$STOPPED_CONTAINERS_FILE" if [ -n "$ACTIVE_AGAIN" ]; then + rm -f "$STOPPED_CONTAINERS_FILE" echo "" echo "⚠️ WARNING: Container(s)$ACTIVE_AGAIN became active again, aborting restore" echo "❌ Volume restore aborted - volume is in use" @@ -134,7 +140,9 @@ export const restoreVolume = async ( if ! docker rm -f "$container_id" >/dev/null 2>&1; then REMOVE_FAILED="$REMOVE_FAILED $container_name" fi - done < <(printf '%s\\n' "$STOPPED_CONTAINERS") + done < "$STOPPED_CONTAINERS_FILE" + + rm -f "$STOPPED_CONTAINERS_FILE" if [ -n "$REMOVE_FAILED" ]; then echo ""