posix: warn at startup when state lives outside storage.root (#821) #825

Closed
Cordy wants to merge 1 commit from fix-821 into main
Owner

Fixes #821 with options 1 + 3 from the issue, log-only (no UI, so no mockup).

  • stateOutsideRoot(cfg) in cmd/cairnd/statepaths.go: on the posix driver (incl. the empty default), returns each directory holding a statePaths entry that is not inside storage.root, deduplicated and sorted. Path containment via filepath.Rel, so /dat is not treated as a parent of /data/.cairn and a trailing slash on the root doesn't matter. s3 never warns.
  • main.go: one WARN right after the posix driver opens, naming storageRoot and stateDirs. A warning, not a refusal: a separately persisted state dir is legitimate.
  • deployment.md: a paragraph under the posix note explaining the trap and the fix (mount the share at /data). CHANGELOG v0.6.311.

Tests: default config is silent; root moved alone → [/data/.cairn]; prefix-not-parent warns; s3 silent; partially moved paths list only the forgotten dir. Ran the binary locally with root=/tmp/t821/root and a custom settings path: the warning lists both /data/.cairn and the custom dir.

Not done (needs a mockup if wanted): an admin overview hint for the same condition.

Fixes #821 with options 1 + 3 from the issue, log-only (no UI, so no mockup). - `stateOutsideRoot(cfg)` in `cmd/cairnd/statepaths.go`: on the posix driver (incl. the empty default), returns each directory holding a `statePaths` entry that is not inside `storage.root`, deduplicated and sorted. Path containment via `filepath.Rel`, so `/dat` is not treated as a parent of `/data/.cairn` and a trailing slash on the root doesn't matter. s3 never warns. - `main.go`: one `WARN` right after the posix driver opens, naming `storageRoot` and `stateDirs`. A warning, not a refusal: a separately persisted state dir is legitimate. - deployment.md: a paragraph under the posix note explaining the trap and the fix (mount the share at `/data`). CHANGELOG v0.6.311. Tests: default config is silent; root moved alone → `[/data/.cairn]`; prefix-not-parent warns; s3 silent; partially moved paths list only the forgotten dir. Ran the binary locally with `root=/tmp/t821/root` and a custom settings path: the warning lists both `/data/.cairn` and the custom dir. Not done (needs a mockup if wanted): an admin overview hint for the same condition.
posix: warn at startup when state lives outside storage.root (#821)
All checks were successful
ci / test-and-build (pull_request) Successful in 1m24s
b7175762d9
Author
Owner

Superseded: decided in review to go with options 2 + 3 instead of a warning (research on #821). Replaced by the fix-821b PR.

Superseded: decided in review to go with options 2 + 3 instead of a warning (research on #821). Replaced by the fix-821b PR.
Cordy closed this pull request 2026-10-01 05:35:35 +00:00
All checks were successful
ci / test-and-build (pull_request) Successful in 1m24s
Required
Details

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Cordy/Cairn#825
No description provided.