Repository navigation
Fix three runvil-vfs leftovers: range reads, a refusal path, and the glob root - #16
Merged
Merged
Conversation
`HandleAccess` is the session of a handle that is mounted as a backend, and its comment said that the capability has no byte-range read. `Access` has `read_range`, so `HandleAccess` now forwards `read_range` to it, and the comment names only the POSIX extras as left on their trait defaults. - A range read through an overlay took the trait default before: the base handle read the whole file and the default sliced it. The base backend now gets the range, so a backend that can seek reads only those bytes. - The policy check, the read claim, and the event are the same on both routes, because `read` and `read_range` of `Access` take the same steps. - The new test in `read_range.rs` reads through an overlay of a handle on `RangeSpy`. It fails without the forward, because the base backend records no range.
A spawn names no path, so its refusal names `/`. `Access::spawn` re-spelled that path for a store view, and the refusal named the empty path there, while the refusal of a new view of the same ended access named `/`. The spawn now reports the path as the scope gives it. - The two calls of `relativize` in `spawn` are removed. A spawn from a plain access is unchanged, because `relativize` left its errors as they were. - Two tests in `tests/store.rs` matched the refusals of `store.view` and of `scope.spawn` on the variant alone. They now check the path of each, which is `/`.
`MemoryBackend` keeps the root in its set of directories, and `/*` matches the spelling `/` with an empty segment, so a glob for directories returned the root: `store.glob('*/')` gave one empty string in an empty store. `MemoryBackend::glob` now leaves the root out, as the walk of `RealBackend` does, because the root holds every stored path and is not one itself.
- The filter is in `glob` of `memory.rs`, so a handle, a store view, and a mount of a memory backend all get it. The patterns `/`, `/*`, `/**`, and `/**/*` matched the root before.
- The docs of `VfsAccess::glob` and `Access::glob` state that no pattern matches the root.
- `a_directory_glob_never_returns_the_root` runs the same assertions on a memory handle in `handle/tests/semantics.rs` and on a real directory in `real/tests/semantics.rs`. The real backend passed them before this change.
- A test in `handle/tests/store.rs` holds the rule for a store view, and one in the `tests/store.rs` of `runvil-lua` holds it for `store.glob`.
[Medium impact] This PR appears safe to merge; no actionable issues were found.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three small fixes in
runvil-vfsthat the private run store work (#15) found and left as they were.Commits
HandleAccesssaid that the capability has no byte-range read.Accesshasread_range, so a range read through an overlay took the trait default: the base handle read the whole file, and the default sliced it.HandleAccessnow forwardsread_range, and a base backend that can seek reads only those bytes. The policy check, the read claim, and the event are the same on both routes./when an ended store view refuses a spawn. A spawn names no path, so its refusal names/. On a store view that path was re-spelled to the empty path, while the refusal of a new view of the same ended access named/. Both name/now.MemoryBackendkeeps the root among its directories, and/*matches the spelling/with an empty segment, so a glob for directories returned the root.store.glob('*/')gave one empty string in an empty store. The memory backend now leaves the root out, as the walk ofRealBackenddoes.Behavior that changes
/,/*,/**, and/**/*returned it before. The real backend already behaved this way, and one test now runs the same assertions on both.ScopeEndedrefusal changes from the empty path to/.Tests
a_read_range_through_an_overlay_reaches_the_base_backend_as_that_rangefails without the forward, because the base backend records no range.a_directory_glob_never_returns_the_rootruns on a memory handle and on a real directory. A test holds the rule for a store view, and one inrunvil-luaholds it forstore.glob.store.viewand a refusedscope.spawnnow check the path, where they matched the variant alone.Checks
Every command in
AGENTS.mdpasses on the final tree, with therun-promptexample,cargo doc -p runvil, the private-items doc build ofrunvil-runtime, andcargo deny check. Nextest runs 3,791 tests, all passing, and skips 24.xtask api --checkpasses with no change to either listing.Left as it is
store_error_messagekeeps its wording for the store codes that the Harness never gives. A caller of the Engine can answer aVfseffect with anyVfsError, so those messages are reachable through the Engine's API.Scope::forkand ofScope::attachis always/, and some test names still say "the access root".Summary by CodeRabbit