From 195d44bde6394633db3d750d06356751a9daab01 Mon Sep 17 00:00:00 2001 From: Matthew Heon Date: Mon, 6 Jul 2020 12:56:52 -0400 Subject: Fix bug where `podman mount` didn't error as rootless We require that rootless `podman mount` be run inside a shell spawned by `podman unshare` (which gives us a mount namespace which actually lets other commands use the mounted filesystem). The fix is simple - we need to mark the command as requiring the rootless user namespace not be configured, so we can test for it later as part of the mount code and error if we needed to make one. Fixes #6856 Signed-off-by: Matthew Heon --- cmd/podman/containers/mount.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/cmd/podman/containers/mount.go b/cmd/podman/containers/mount.go index 2de1066a3..186c4df16 100644 --- a/cmd/podman/containers/mount.go +++ b/cmd/podman/containers/mount.go @@ -30,13 +30,18 @@ var ( Args: func(cmd *cobra.Command, args []string) error { return validate.CheckAllLatestAndCIDFile(cmd, args, true, false) }, + Annotations: map[string]string{ + registry.ParentNSRequired: "", + }, } containerMountCommmand = &cobra.Command{ - Use: mountCommand.Use, - Short: mountCommand.Short, - Long: mountCommand.Long, - RunE: mountCommand.RunE, + Use: mountCommand.Use, + Short: mountCommand.Short, + Long: mountCommand.Long, + RunE: mountCommand.RunE, + Args: mountCommand.Args, + Annotations: mountCommand.Annotations, } ) -- cgit v1.2.3-54-g00ecf From f4c649bdec3c6eed7541f2c4c60d69e89ef228f7 Mon Sep 17 00:00:00 2001 From: Matthew Heon Date: Mon, 6 Jul 2020 15:29:11 -0400 Subject: Disable mount tests as rootless As rootless, `podman mount` must be run inside `podman unshare`. We don't really have a testing harness that can do this right now. Signed-off-by: Matthew Heon --- test/e2e/mount_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/test/e2e/mount_test.go b/test/e2e/mount_test.go index dd74f245e..657daedef 100644 --- a/test/e2e/mount_test.go +++ b/test/e2e/mount_test.go @@ -18,6 +18,7 @@ var _ = Describe("Podman mount", func() { ) BeforeEach(func() { + SkipIfRootless() tempdir, err = CreateTempDirInTempDir() if err != nil { os.Exit(1) -- cgit v1.2.3-54-g00ecf