Merge pull request #265 from thaJeztah/18.09_backport_do_not_order_uid_gid_mappings
[18.09 backport] Stop sorting uid and gid ranges in id maps Upstream-commit: 047143abc38294668b1680c46e8ea0868838beb0 Component: engine
This commit is contained in:
@ -4,7 +4,6 @@ import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"os"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
@ -203,8 +202,6 @@ func (i *IdentityMapping) GIDs() []IDMap {
|
||||
func createIDMap(subidRanges ranges) []IDMap {
|
||||
idMap := []IDMap{}
|
||||
|
||||
// sort the ranges by lowest ID first
|
||||
sort.Sort(subidRanges)
|
||||
containerID := 0
|
||||
for _, idrange := range subidRanges {
|
||||
idMap = append(idMap, IDMap{
|
||||
|
||||
28
components/engine/pkg/idtools/idtools_test.go
Normal file
28
components/engine/pkg/idtools/idtools_test.go
Normal file
@ -0,0 +1,28 @@
|
||||
package idtools // import "github.com/docker/docker/pkg/idtools"
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
)
|
||||
|
||||
func TestCreateIDMapOrder(t *testing.T) {
|
||||
subidRanges := ranges{
|
||||
{100000, 1000},
|
||||
{1000, 1},
|
||||
}
|
||||
|
||||
idMap := createIDMap(subidRanges)
|
||||
assert.DeepEqual(t, idMap, []IDMap{
|
||||
{
|
||||
ContainerID: 0,
|
||||
HostID: 100000,
|
||||
Size: 1000,
|
||||
},
|
||||
{
|
||||
ContainerID: 1000,
|
||||
HostID: 1000,
|
||||
Size: 1,
|
||||
},
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user