Skip to content

Commit

Permalink
Merge pull request containers#20961 from karuboniru/patch-1
Browse files Browse the repository at this point in the history
fix checking of relative idmapped mount
  • Loading branch information
openshift-merge-bot[bot] authored Jan 11, 2024
2 parents 238d08f + 23f6c48 commit 83f89db
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion libpod/container_internal_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions test/system/030-run.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 83f89db

Please sign in to comment.