Merge pull request #20961 from karuboniru/patch-1

fix checking of relative idmapped mount
This commit is contained in:
openshift-merge-bot[bot]
2024-01-11 17:20:56 +00:00
committed by GitHub
2 changed files with 6 additions and 1 deletions

View File

@ -84,7 +84,7 @@ func parseOptionIDs(ctrMappings []idtools.IDMap, option string) ([]idtools.IDMap
if relative {
found := false
for _, m := range ctrMappings {
if v.ContainerID >= m.ContainerID && v.ContainerID < m.ContainerID+m.Size {
if v.HostID >= m.ContainerID && v.HostID < m.ContainerID+m.Size {
v.HostID += m.HostID - m.ContainerID
found = true
break

View File

@ -1251,6 +1251,11 @@ EOF
run_podman run --uidmap=0:1000:10000 --rm --rootfs "$romount:idmap=uids=0-1001-10000;gids=0-1002-10000" stat -c %u:%g /bin
is "$output" "1:2"
touch $romount/testfile
chown 2000:2000 $romount/testfile
run_podman run --uidmap=0:1000:2 --rm --rootfs "$romount:idmap=uids=@2000-1-1;gids=@2000-1-1" stat -c %u:%g /testfile
is "$output" "1:1"
rm -rf $romount
}