diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-10-10 19:48:37 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-10-10 19:56:30 +0900 |
| commit | f6dd9dab6a91c8c39ea2a5afbca50e427e6a21ba (patch) | |
| tree | a3318b15c1b4c4c5cf1571a90c562687bebe5ff7 /internal/app/spcontainer.go | |
| parent | 776650af01d56d1c38861420de7f4a077f0a61f8 (diff) | |
internal/app: hold path hiding in op
This makes no sense to be part of the global state.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/app/spcontainer.go')
| -rw-r--r-- | internal/app/spcontainer.go | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/internal/app/spcontainer.go b/internal/app/spcontainer.go index 3426e7ea..62fffc8a 100644 --- a/internal/app/spcontainer.go +++ b/internal/app/spcontainer.go @@ -117,12 +117,15 @@ func (s *spParamsOp) toContainer(state *outcomeStateParams) error { return nil } -func init() { gob.Register(spFilesystemOp{}) } +func init() { gob.Register(new(spFilesystemOp)) } // spFilesystemOp applies configured filesystems to [container.Params], excluding the optional root filesystem. -type spFilesystemOp struct{} +type spFilesystemOp struct { + // Matched paths to cover. Stored during toSystem. + HidePaths []*check.Absolute +} -func (s spFilesystemOp) toSystem(state *outcomeStateSys) error { +func (s *spFilesystemOp) toSystem(state *outcomeStateSys) error { /* retrieve paths and hide them if they're made available in the sandbox; this feature tries to improve user experience of permissive defaults, and @@ -253,7 +256,7 @@ func (s spFilesystemOp) toSystem(state *outcomeStateSys) error { } return newWithMessage("invalid path hiding candidate " + strconv.Quote(absoluteError.Pathname)) } else { - state.HidePaths = append(state.HidePaths, a) + s.HidePaths = append(s.HidePaths, a) } } } @@ -261,7 +264,7 @@ func (s spFilesystemOp) toSystem(state *outcomeStateSys) error { return nil } -func (s spFilesystemOp) toContainer(state *outcomeStateParams) error { +func (s *spFilesystemOp) toContainer(state *outcomeStateParams) error { for i, c := range state.filesystem { if !c.Valid() { return newWithMessage("invalid filesystem at index " + strconv.Itoa(i)) @@ -269,7 +272,7 @@ func (s spFilesystemOp) toContainer(state *outcomeStateParams) error { c.Apply(&state.as) } - for _, a := range state.HidePaths { + for _, a := range s.HidePaths { state.params.Tmpfs(a, 1<<13, 0755) } |
