Skip to content

Commit 0807efb

Browse files
authored
Merge pull request containerd#10021 from sctb512/fix-unstable-sort
fix(cri): fix unexpected order of mounts since go 1.19
2 parents 3a8c27d + 3830f81 commit 0807efb

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

internal/cri/opts/spec_darwin_opts.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func WithDarwinMounts(osi osinterface.OS, config *runtime.ContainerConfig, extra
5858

5959
// Sort mounts in number of parts. This ensures that high level mounts don't
6060
// shadow other mounts.
61-
sort.Sort(orderedMounts(mounts))
61+
sort.Stable(orderedMounts(mounts))
6262

6363
// Copy all mounts from default mounts, except for
6464
// - mounts overridden by supplied mount;

internal/cri/opts/spec_linux_opts.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ func WithMounts(osi osinterface.OS, config *runtime.ContainerConfig, extra []*ru
6565

6666
// Sort mounts in number of parts. This ensures that high level mounts don't
6767
// shadow other mounts.
68-
sort.Sort(orderedMounts(mounts))
68+
sort.Stable(orderedMounts(mounts))
6969

7070
// Mount cgroup into the container as readonly, which inherits docker's behavior.
7171
s.Mounts = append(s.Mounts, runtimespec.Mount{

internal/cri/opts/spec_windows_opts.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ func WithWindowsMounts(osi osinterface.OS, config *runtime.ContainerConfig, extr
128128

129129
// Sort mounts in number of parts. This ensures that high level mounts don't
130130
// shadow other mounts.
131-
sort.Sort(orderedMounts(mounts))
131+
sort.Stable(orderedMounts(mounts))
132132

133133
// Copy all mounts from default mounts, except for
134134
// mounts overridden by supplied mount;

0 commit comments

Comments
 (0)