container/autoroot: remove prefix field
All checks were successful
Test / Create distribution (push) Successful in 34s
Test / Sandbox (push) Successful in 2m9s
Test / Hakurei (push) Successful in 3m12s
Test / Hpkg (push) Successful in 4m14s
Test / Sandbox (race detector) (push) Successful in 5m23s
Test / Hakurei (race detector) (push) Successful in 3m2s
Test / Flake checks (push) Successful in 1m23s
All checks were successful
Test / Create distribution (push) Successful in 34s
Test / Sandbox (push) Successful in 2m9s
Test / Hakurei (push) Successful in 3m12s
Test / Hpkg (push) Successful in 4m14s
Test / Sandbox (race detector) (push) Successful in 5m23s
Test / Hakurei (race detector) (push) Successful in 3m2s
Test / Flake checks (push) Successful in 1m23s
This field has been a noop for a long time. Remove it to prevent further confusion. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
parent
33d2dcce1b
commit
cedfceded5
@ -10,14 +10,13 @@ func init() { gob.Register(new(AutoRootOp)) }
|
||||
|
||||
// Root appends an [Op] that expands a directory into a toplevel bind mount mirror on container root.
|
||||
// This is not a generic setup op. It is implemented here to reduce ipc overhead.
|
||||
func (f *Ops) Root(host *Absolute, prefix string, flags int) *Ops {
|
||||
*f = append(*f, &AutoRootOp{host, prefix, flags, nil})
|
||||
func (f *Ops) Root(host *Absolute, flags int) *Ops {
|
||||
*f = append(*f, &AutoRootOp{host, flags, nil})
|
||||
return f
|
||||
}
|
||||
|
||||
type AutoRootOp struct {
|
||||
Host *Absolute
|
||||
Prefix string
|
||||
// passed through to bindMount
|
||||
Flags int
|
||||
|
||||
@ -71,12 +70,11 @@ func (r *AutoRootOp) Is(op Op) bool {
|
||||
vr, ok := op.(*AutoRootOp)
|
||||
return ok && r.Valid() && vr.Valid() &&
|
||||
r.Host.Is(vr.Host) &&
|
||||
r.Prefix == vr.Prefix &&
|
||||
r.Flags == vr.Flags
|
||||
}
|
||||
func (*AutoRootOp) prefix() string { return "setting up" }
|
||||
func (r *AutoRootOp) String() string {
|
||||
return fmt.Sprintf("auto root %q prefix %s flags %#x", r.Host, r.Prefix, r.Flags)
|
||||
return fmt.Sprintf("auto root %q flags %#x", r.Host, r.Flags)
|
||||
}
|
||||
|
||||
// IsAutoRootBindable returns whether a dir entry name is selected for AutoRoot.
|
||||
|
@ -10,7 +10,7 @@ import (
|
||||
func TestAutoRootOp(t *testing.T) {
|
||||
t.Run("nonrepeatable", func(t *testing.T) {
|
||||
wantErr := msg.WrapErr(fs.ErrInvalid, "autoroot is not repeatable")
|
||||
if err := (&AutoRootOp{Prefix: "81ceabb30d37bbdb3868004629cb84e9"}).apply(&setupState{nonrepeatable: nrAutoRoot}, nil); !errors.Is(err, wantErr) {
|
||||
if err := new(AutoRootOp).apply(&setupState{nonrepeatable: nrAutoRoot}, nil); !errors.Is(err, wantErr) {
|
||||
t.Errorf("apply: error = %v, want %v", err, wantErr)
|
||||
}
|
||||
})
|
||||
@ -18,7 +18,6 @@ func TestAutoRootOp(t *testing.T) {
|
||||
checkOpBehaviour(t, []opBehaviourTestCase{
|
||||
{"readdir", &Params{ParentPerm: 0750}, &AutoRootOp{
|
||||
Host: MustAbs("/"),
|
||||
Prefix: "81ceabb30d37bbdb3868004629cb84e9",
|
||||
Flags: BindWritable,
|
||||
}, []kexpect{
|
||||
{"readdir", expectArgs{"/"}, stubDir(), errUnique},
|
||||
@ -26,7 +25,6 @@ func TestAutoRootOp(t *testing.T) {
|
||||
|
||||
{"early", &Params{ParentPerm: 0750}, &AutoRootOp{
|
||||
Host: MustAbs("/"),
|
||||
Prefix: "81ceabb30d37bbdb3868004629cb84e9",
|
||||
Flags: BindWritable,
|
||||
}, []kexpect{
|
||||
{"readdir", expectArgs{"/"}, stubDir("bin", "dev", "etc", "home", "lib64",
|
||||
@ -36,7 +34,6 @@ func TestAutoRootOp(t *testing.T) {
|
||||
|
||||
{"apply", &Params{ParentPerm: 0750}, &AutoRootOp{
|
||||
Host: MustAbs("/"),
|
||||
Prefix: "81ceabb30d37bbdb3868004629cb84e9",
|
||||
Flags: BindWritable,
|
||||
}, []kexpect{
|
||||
{"readdir", expectArgs{"/"}, stubDir("bin", "dev", "etc", "home", "lib64",
|
||||
@ -59,7 +56,6 @@ func TestAutoRootOp(t *testing.T) {
|
||||
|
||||
{"success pd", &Params{ParentPerm: 0750}, &AutoRootOp{
|
||||
Host: MustAbs("/"),
|
||||
Prefix: "81ceabb30d37bbdb3868004629cb84e9",
|
||||
Flags: BindWritable,
|
||||
}, []kexpect{
|
||||
{"readdir", expectArgs{"/"}, stubDir("bin", "dev", "etc", "home", "lib64",
|
||||
@ -91,7 +87,6 @@ func TestAutoRootOp(t *testing.T) {
|
||||
|
||||
{"success", &Params{ParentPerm: 0750}, &AutoRootOp{
|
||||
Host: MustAbs("/var/lib/planterette/base/debian:f92c9052"),
|
||||
Prefix: "81ceabb30d37bbdb3868004629cb84e9",
|
||||
}, []kexpect{
|
||||
{"readdir", expectArgs{"/var/lib/planterette/base/debian:f92c9052"}, stubDir("bin", "dev", "etc", "home", "lib64",
|
||||
"lost+found", "mnt", "nix", "proc", "root", "run", "srv", "sys", "tmp", "usr", "var"), nil},
|
||||
@ -128,10 +123,9 @@ func TestAutoRootOp(t *testing.T) {
|
||||
})
|
||||
|
||||
checkOpsBuilder(t, []opsBuilderTestCase{
|
||||
{"pd", new(Ops).Root(MustAbs("/"), "048090b6ed8f9ebb10e275ff5d8c0659", BindWritable), Ops{
|
||||
{"pd", new(Ops).Root(MustAbs("/"), BindWritable), Ops{
|
||||
&AutoRootOp{
|
||||
Host: MustAbs("/"),
|
||||
Prefix: "048090b6ed8f9ebb10e275ff5d8c0659",
|
||||
Flags: BindWritable,
|
||||
},
|
||||
}},
|
||||
@ -142,52 +136,34 @@ func TestAutoRootOp(t *testing.T) {
|
||||
|
||||
{"internal ne", &AutoRootOp{
|
||||
Host: MustAbs("/"),
|
||||
Prefix: ":3",
|
||||
Flags: BindWritable,
|
||||
}, &AutoRootOp{
|
||||
Host: MustAbs("/"),
|
||||
Prefix: ":3",
|
||||
Flags: BindWritable,
|
||||
resolved: []Op{new(BindMountOp)},
|
||||
}, true},
|
||||
|
||||
{"prefix differs", &AutoRootOp{
|
||||
Host: MustAbs("/"),
|
||||
Prefix: "\x00",
|
||||
Flags: BindWritable,
|
||||
}, &AutoRootOp{
|
||||
Host: MustAbs("/"),
|
||||
Prefix: ":3",
|
||||
Flags: BindWritable,
|
||||
}, false},
|
||||
|
||||
{"flags differs", &AutoRootOp{
|
||||
Host: MustAbs("/"),
|
||||
Prefix: ":3",
|
||||
Flags: BindWritable | BindDevice,
|
||||
}, &AutoRootOp{
|
||||
Host: MustAbs("/"),
|
||||
Prefix: ":3",
|
||||
Flags: BindWritable,
|
||||
}, false},
|
||||
|
||||
{"host differs", &AutoRootOp{
|
||||
Host: MustAbs("/tmp/"),
|
||||
Prefix: ":3",
|
||||
Flags: BindWritable,
|
||||
}, &AutoRootOp{
|
||||
Host: MustAbs("/"),
|
||||
Prefix: ":3",
|
||||
Flags: BindWritable,
|
||||
}, false},
|
||||
|
||||
{"equals", &AutoRootOp{
|
||||
Host: MustAbs("/"),
|
||||
Prefix: ":3",
|
||||
Flags: BindWritable,
|
||||
}, &AutoRootOp{
|
||||
Host: MustAbs("/"),
|
||||
Prefix: ":3",
|
||||
Flags: BindWritable,
|
||||
}, true},
|
||||
})
|
||||
@ -195,9 +171,8 @@ func TestAutoRootOp(t *testing.T) {
|
||||
checkOpMeta(t, []opMetaTestCase{
|
||||
{"root", &AutoRootOp{
|
||||
Host: MustAbs("/"),
|
||||
Prefix: ":3",
|
||||
Flags: BindWritable,
|
||||
}, "setting up", `auto root "/" prefix :3 flags 0x2`},
|
||||
}, "setting up", `auto root "/" flags 0x2`},
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ var testCasesPd = []sealTestCase{
|
||||
"XDG_SESSION_TYPE=tty",
|
||||
},
|
||||
Ops: new(container.Ops).
|
||||
Root(m("/"), "4a450b6596d7bc15bd01780eb9a607ac", container.BindWritable).
|
||||
Root(m("/"), container.BindWritable).
|
||||
Proc(m("/proc/")).
|
||||
Tmpfs(hst.AbsTmp, 4096, 0755).
|
||||
DevWritable(m("/dev/"), true).
|
||||
@ -179,7 +179,7 @@ var testCasesPd = []sealTestCase{
|
||||
"XDG_SESSION_TYPE=tty",
|
||||
},
|
||||
Ops: new(container.Ops).
|
||||
Root(m("/"), "ebf083d1b175911782d413369b64ce7c", container.BindWritable).
|
||||
Root(m("/"), container.BindWritable).
|
||||
Proc(m("/proc/")).
|
||||
Tmpfs(hst.AbsTmp, 4096, 0755).
|
||||
DevWritable(m("/dev/"), true).
|
||||
|
@ -75,7 +75,7 @@ func newContainer(s *hst.ContainerConfig, os sys.State, prefix string, uid, gid
|
||||
}
|
||||
|
||||
if s.AutoRoot != nil {
|
||||
params.Root(s.AutoRoot, prefix, s.RootFlags)
|
||||
params.Root(s.AutoRoot, s.RootFlags)
|
||||
}
|
||||
|
||||
params.
|
||||
|
Loading…
x
Reference in New Issue
Block a user