mirror of
https://github.com/moby/buildkit.git
synced 2026-08-04 14:50:21 +00:00
file: fix double-remap of old uid value
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
@@ -34,16 +34,17 @@ func mapUserToChowner(user *copy.User, idmap *idtools.IdentityMapping) (copy.Cho
|
||||
return nil, nil
|
||||
}
|
||||
old = ©.User{} // root
|
||||
}
|
||||
if idmap != nil {
|
||||
identity, err := idmap.ToHost(idtools.Identity{
|
||||
UID: old.Uid,
|
||||
GID: old.Gid,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
// non-nil old is already mapped
|
||||
if idmap != nil {
|
||||
identity, err := idmap.ToHost(idtools.Identity{
|
||||
UID: old.Uid,
|
||||
GID: old.Gid,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return ©.User{Uid: identity.UID, Gid: identity.GID}, nil
|
||||
}
|
||||
return ©.User{Uid: identity.UID, Gid: identity.GID}, nil
|
||||
}
|
||||
return old, nil
|
||||
}, nil
|
||||
|
||||
Reference in New Issue
Block a user