Read-only local stores should avoid creating temproots
#992
Labels
No labels
Affects/CppNix
Affects/Nightly
Affects/Only nightly
Affects/Stable
Area/build-packaging
Area/cli
Area/evaluator
Area/fetching
Area/flakes
Area/language
Area/lix ci
Area/nix-eval-jobs
Area/profiles
Area/protocol
Area/releng
Area/remote-builds
Area/repl
Area/repl/debugger
Area/store
bug
Context
contributors
Context
drive-by
Context
maintainers
Context
RFD
crash 💥
Cross Compilation
devx
docs
Downstream Dependents
E/easy
E/hard
E/help wanted
E/reproducible
E/requires rearchitecture
Feature/S3
imported
Language/Bash
Language/C++
Language/NixLang
Language/Python
Language/Rust
Needs Langver
OS/Linux
OS/macOS
performance
regression
release-blocker
stability
Status
blocked
Status
invalid
Status
postponed
Status
wontfix
testing
testing/flakey
Topic/Large Scale Installations
ux
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: lix-project/lix#992
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Even under
read-only
(read-only-local-store
xp feature), the local store will attemptcreateDirs(tempRootsDir);
, this won't work if the local store is read only and this directory doesn't exist.To avoid this scenario, do not fail if that directory cannot be created.
Temproots cannot be used as:
note that this is necessarily unsound without a storage format update: a concurrent read-write store connection could delete existing store paths that are in use by read-only connections. the only way to make this sound is to force all connections to take a lock of some kind, such that no read-write connection can exist while read-only connections are active. since that reverses the usual lock order and can bring a system to a complete halt when used without great care we're not convinced that read-only local store connections are safe under any circumstances
this should be safe provided that we do try to take the temp root no matter what and just tolerate failure in the case of read only connections (but permissions issues because you're regular user on a system with a daemon means it is unsound ...)
it really isn't. the readonlyness may be implied by a ro bind mount into a container, simply not setting a temproot for those can cause in-use paths to just disappear. the only safe use for ro stores is when rw stores are excluded or no gc can be run, both of which we can never guarantee without modifying the file system (or at least our db layout)
After some discussion, I believe it is safe in one special scenario: when the source is truly read-only, i.e. any process on the system will receive errors trying to write inside the local store. There's various guarantees level of this concept: a read-only block or fs (virtio bind RO, EROFS, etc.), a filesystem already mounted in
ro
with no possibility to remount `rw, etc.It feels like more a
dangerous-features
than anexperimental-features
at this point, so I would be inclined to probably explore this sort of concept and extend the relevant code for this dangerous feature?We could also loudly warn about it for now.