From 9e919c61e380816f418f4015d5e1c7940285c4b1 Mon Sep 17 00:00:00 2001 From: Alban Crequy Date: Fri, 9 Mar 2018 17:30:59 +0100 Subject: [PATCH] runtimetest: fix root readonly check The rootfs might not be readable despite spec.Root.Readonly being false and that's not a spec violation. Example: the rootfs belong to an unmapped uid. This test is useful for validation/root_readonly_true.go Delete validation/root_readonly_false.go since that's not a spec violation. Signed-off-by: Alban Crequy --- cmd/runtimetest/main.go | 7 +------ validation/root_readonly_false.go | 14 -------------- 2 files changed, 1 insertion(+), 20 deletions(-) delete mode 100644 validation/root_readonly_false.go diff --git a/cmd/runtimetest/main.go b/cmd/runtimetest/main.go index a0dd592a2..c7abbb66b 100644 --- a/cmd/runtimetest/main.go +++ b/cmd/runtimetest/main.go @@ -328,12 +328,7 @@ func validateRootFS(spec *rspec.Spec) error { if err == nil { return specerror.NewError(specerror.RootReadonlyImplement, fmt.Errorf("rootfs must be readonly"), rspec.Version) } - } else { - err := testWriteAccess("/") - if err != nil { - return specerror.NewError(specerror.RootReadonlyImplement, fmt.Errorf("rootfs must not be readonly"), rspec.Version) - } - } + } // no need to check the else case: unwriteable root is not a spec violation return nil } diff --git a/validation/root_readonly_false.go b/validation/root_readonly_false.go deleted file mode 100644 index 6349ccd15..000000000 --- a/validation/root_readonly_false.go +++ /dev/null @@ -1,14 +0,0 @@ -package main - -import ( - "github.com/opencontainers/runtime-tools/validation/util" -) - -func main() { - g := util.GetDefaultGenerator() - g.SetRootReadonly(false) - err := util.RuntimeInsideValidate(g, nil) - if err != nil { - util.Fatal(err) - } -}