Skip to content

Commit

Permalink
Fix bug where podman mount didn't error as rootless
Browse files Browse the repository at this point in the history
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.

Disable rootless tests as part of this - they were never expected
to work.

Fixes containers#6856

Signed-off-by: Matthew Heon <[email protected]>
  • Loading branch information
mheon committed Jul 6, 2020
1 parent e3e2b1e commit 8ab0abb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
13 changes: 9 additions & 4 deletions cmd/podman/containers/mount.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
)

Expand Down
1 change: 1 addition & 0 deletions test/e2e/mount_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ var _ = Describe("Podman mount", func() {
)

BeforeEach(func() {
SkipIfRootless()
tempdir, err = CreateTempDirInTempDir()
if err != nil {
os.Exit(1)
Expand Down

0 comments on commit 8ab0abb

Please sign in to comment.