Skip to content

fix: restore a new volume's root owner and mode from the archive - #4887

Merged
kmendell merged 1 commit into
getarcaneapp:mainfrom
neurekadev:fix/4885-restore-volume-root-from-archive
Nov 18, 2026
Merged

kmendell merged 1 commit into
getarcaneapp:mainfrom
neurekadev:fix/4885-restore-volume-root-from-archive

Conversation

@neurekadev

@neurekadev neurekadev commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Important

Merge order: this PR, then getarcaneapp/tools#22 (adds chown/chmod to the tools image). This one alone changes nothing until the tools image has chown. The tools change alone would make restores succeed with a world-writable root:root 0777 volume root, which is why this goes first.

Checklist

  • This PR is not opened from my fork’s main branch
  • All new user-facing strings are translated via Paraglide (m.*()) (no new strings)

What This PR Implements

Fixes: #4885 (together with the tools PR)

When UploadAndRestore restores into a newly created Compose volume (project copy/move with volumes, and the planned project import), it tried to give the volume root the archive root's owner and mode. It did that by copying them from the temp extract dir. But CopyToContainer doesn't apply the archive's ./ entry to an existing directory, and mkdir in the tools image creates the temp dir as 777. So the root always became root:root 0777, and a 999:999 0700 Postgres root wasn't preserved. With today's tools image the step fails earlier with chown: not found.

Changes Made

  • volume/children/backup/children/restore/service.go: keep the archive's first header (already read for validation). When it's the root dir entry, set /volume to its uid:gid and mode with plain chown and chmod execs, so there's no sh pipeline or stat. Archives without a root entry keep Docker's default root.

Testing Done

  • just format go, just lint backend (0 issues), go build -tags exclude_frontend ./..., go test ./internal/volume/....
  • Reproduced the root cause against the tools image: after mkdir plus docker cp of an archive whose ./ is 0/0 drwxr-xr-x, the temp dir is still 0:0 777.
  • End-to-end restore results are below in Evidence.

Additional Context

  • Arcane keeps using a local tools:latest once it has one (getVolumeHelperImage doesn't pull it again). Existing installs only get the new chown/chmod after that image is refreshed, for example with docker pull ghcr.io/getarcaneapp/tools:latest. That predates this PR.

AI Tool Used (if applicable)

Claude Code (Claude Opus 5.5) investigated this, wrote the change and drafted this description, at my direction.

🤖 Generated with Claude Code

📸 Evidence

Surfaces: 1 Captured: 1 Open: 0

Before main @ 8612ea241 → After fix/4885-restore-volume-root-from-archive @ f368357b9 · seeded test project evidence-shop on a sandbox Docker engine; volume root set to 999:999 0700 like a Postgres data volume; no private data

Surface Viewport Capture Look for
🔌 Restoring into a new Compose volume (project import) — Response excerpt The new volume's root keeps the archive root's owner and mode instead of failing or becoming root:root 0777

🔌 Restoring into a new Compose volume (project import)

- current tools image:          failed to restore volume root ownership: sh: line 0: chown: not found
- tools#22 only (no #4887):     evidence-shop-copy_site root = 0:0 777
+ tools#22 + this PR:           evidence-shop-copy_site root = 999:999 700, index.html restored, containers Up

📸 Captured by Claude Opus 5.5 (High) · T3 Code (Claude Code) · Arcane images built with docker/Dockerfile; tools image built with getarcaneapp/tools just build (#22) · 2026-11-18 22:43 UTC

Disclaimer Greptiles Reviews use AI, make sure to check over its work.

To better help train Greptile on our codebase, if the comment is useful and valid Like the comment, if its not helpful or invalid Dislike

To have Greptile Re-Review the changes, mention greptileai.

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge in the stated order, before tools#22.

Summary

New Compose volumes now take their root owner and permissions from the archive’s first entry when it describes the root directory.

  • New Compose volumes keep the root owner and mode from the archive.

No actionable issues found. Tests were not run. Access to the related repositories was denied, so their compatibility could not be fully checked.

Reviews (1) · Last reviewed commit: "fix: restore a new volume's root owner a..." · Reviewed by Greptile

Restoring an uploaded archive into a newly created Compose volume copied
the owner and mode of the temporary extract directory onto the volume
root, assuming the archive's root entry had been applied to it. Docker's
copy skips that entry for an existing directory, so the root always
ended up root:root 0777. Take the uid, gid, and mode from the archive's
root entry instead, and set them with plain chown and chmod rather than a
shell pipeline.

Refs getarcaneapp#4885

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@neurekadev

Copy link
Copy Markdown
Contributor Author

🔍 Code Review

PR #4887 · e8e5b231f..f368357b9 · 1 files · ✅ No findings

Critical: 0 High: 0 Medium: 0 Low: 0 Informational: 0

🤖 Claude Opus 5.5 (High) · T3 Code (Claude Code) · Round 1 of 3

@kmendell
kmendell merged commit a75a195 into getarcaneapp:main Nov 18, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐞 Bug: Project copy/move with volumes fails: chown not found in the tools helper image

2 participants