Skip to content

Commit

Permalink
Fix a regression introduced by #6008 adding bind mounts without desti…
Browse files Browse the repository at this point in the history
…nation two times
  • Loading branch information
cclerget committed Sep 4, 2021
1 parent 4b3ebbd commit 26a215e
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
1 change: 1 addition & 0 deletions e2e/actions/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -2270,6 +2270,7 @@ func E2ETests(env e2e.TestEnv) testhelper.Tests {
"issue 5599": c.issue5599, // https://github.com/hpcng/singularity/issues/5599
"issue 5631": c.issue5631, // https://github.com/hpcng/singularity/issues/5631
"issue 5690": c.issue5690, // https://github.com/hpcng/singularity/issues/5690
"issue 6165": c.issue6165, // https://github.com/hpcng/singularity/issues/6165
"network": c.actionNetwork, // test basic networking
"binds": c.actionBinds, // test various binds
"exit and signals": c.exitSignals, // test exit and signals propagation
Expand Down
33 changes: 33 additions & 0 deletions e2e/actions/regressions.go
Original file line number Diff line number Diff line change
Expand Up @@ -684,3 +684,36 @@ func (c actionTests) invalidRemote(t *testing.T) {
)

}

// Check that a bind mount without a destination is not added two times.
func (c actionTests) issue6165(t *testing.T) {
e2e.EnsureImage(t, c.env)

workspace, cleanup := e2e.MakeTempDir(t, c.env.TestDir, "issue6165-", "")
defer e2e.Privileged(cleanup)

hostCanaryFile := filepath.Join(workspace, "file")

if err := fs.Touch(hostCanaryFile); err != nil {
t.Fatalf("failed to create canary_file: %s", err)
}

c.env.RunSingularity(
t,
e2e.WithProfile(e2e.UserProfile),
e2e.WithCommand("exec"),
e2e.WithArgs(
"--contain",
"--bind", hostCanaryFile,
c.env.ImagePath,
"test", "-f", hostCanaryFile,
),
e2e.ExpectExit(
0,
e2e.ExpectError(
e2e.UnwantedContainMatch,
"destination is already in the mount point list",
),
),
)
}
2 changes: 2 additions & 0 deletions pkg/runtime/engine/singularity/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,8 @@ func ParseBindPath(paths []string) ([]BindPath, error) {
}
binds = append(binds, bp)
elem = 0
bind = ""
continue
}
// new bind path
bind = s
Expand Down

0 comments on commit 26a215e

Please sign in to comment.