diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-08-20 02:22:04 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-08-20 02:22:04 +0900 |
| commit | e463faf6499fa537f6048857e10d123554112af6 (patch) | |
| tree | 9493f0bb21a7d1edc8c7c0a922730b73957c6f5e /container/initbind.go | |
| parent | 375acb476d36cac8e122ae8c45628bd8e7e0f0ca (diff) | |
container/initbind: check path equivalence by value
Same problem as autoroot, never updated the checks after integrating Absolute.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'container/initbind.go')
| -rw-r--r-- | container/initbind.go | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/container/initbind.go b/container/initbind.go index 12db42d8..17cd9598 100644 --- a/container/initbind.go +++ b/container/initbind.go @@ -85,10 +85,21 @@ func (b *BindMountOp) apply(*setupState) error { return hostProc.bindMount(source, target, flags, b.sourceFinal == b.Target) } -func (b *BindMountOp) Is(op Op) bool { vb, ok := op.(*BindMountOp); return ok && *b == *vb } -func (*BindMountOp) prefix() string { return "mounting" } +func (b *BindMountOp) Is(op Op) bool { + vb, ok := op.(*BindMountOp) + return ok && ((b == nil && vb == nil) || (b != nil && vb != nil && + b.Source != nil && vb.Source != nil && + b.Source.String() == vb.Source.String() && + b.Target != nil && vb.Target != nil && + b.Target.String() == vb.Target.String() && + b.Flags == vb.Flags)) +} +func (*BindMountOp) prefix() string { return "mounting" } func (b *BindMountOp) String() string { - if b.Source == b.Target { + if b.Source == nil || b.Target == nil { + return "<invalid>" + } + if b.Source.String() == b.Target.String() { return fmt.Sprintf("%q flags %#x", b.Source, b.Flags) } return fmt.Sprintf("%q on %q flags %#x", b.Source, b.Target, b.Flags) |
