Skip to content

Commit 8ccb943

Browse files
cclergetkmuriki
authored andcommitted
Fix a regression introduced by #6008 adding bind mounts without destination two times
1 parent 08dd8e6 commit 8ccb943

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

e2e/actions/actions.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2270,6 +2270,7 @@ func E2ETests(env e2e.TestEnv) testhelper.Tests {
22702270
"issue 5599": c.issue5599, // https://github.com/hpcng/singularity/issues/5599
22712271
"issue 5631": c.issue5631, // https://github.com/hpcng/singularity/issues/5631
22722272
"issue 5690": c.issue5690, // https://github.com/hpcng/singularity/issues/5690
2273+
"issue 6165": c.issue6165, // https://github.com/hpcng/singularity/issues/6165
22732274
"network": c.actionNetwork, // test basic networking
22742275
"binds": c.actionBinds, // test various binds
22752276
"exit and signals": c.exitSignals, // test exit and signals propagation

e2e/actions/regressions.go

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -684,3 +684,36 @@ func (c actionTests) invalidRemote(t *testing.T) {
684684
)
685685

686686
}
687+
688+
// Check that a bind mount without a destination is not added two times.
689+
func (c actionTests) issue6165(t *testing.T) {
690+
e2e.EnsureImage(t, c.env)
691+
692+
workspace, cleanup := e2e.MakeTempDir(t, c.env.TestDir, "issue6165-", "")
693+
defer e2e.Privileged(cleanup)
694+
695+
hostCanaryFile := filepath.Join(workspace, "file")
696+
697+
if err := fs.Touch(hostCanaryFile); err != nil {
698+
t.Fatalf("failed to create canary_file: %s", err)
699+
}
700+
701+
c.env.RunSingularity(
702+
t,
703+
e2e.WithProfile(e2e.UserProfile),
704+
e2e.WithCommand("exec"),
705+
e2e.WithArgs(
706+
"--contain",
707+
"--bind", hostCanaryFile,
708+
c.env.ImagePath,
709+
"test", "-f", hostCanaryFile,
710+
),
711+
e2e.ExpectExit(
712+
0,
713+
e2e.ExpectError(
714+
e2e.UnwantedContainMatch,
715+
"destination is already in the mount point list",
716+
),
717+
),
718+
)
719+
}

pkg/runtime/engine/singularity/config/config.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,8 @@ func ParseBindPath(paths []string) ([]BindPath, error) {
408408
}
409409
binds = append(binds, bp)
410410
elem = 0
411+
bind = ""
412+
continue
411413
}
412414
// new bind path
413415
bind = s

0 commit comments

Comments
 (0)