Merge pull request 'fix: map gid instead uid' (#1) from Maks1mS/fakeroot:fix-gid-mapping into master

Reviewed-on: #1
This commit is contained in:
Евгений Храмов 2025-04-08 10:48:31 +00:00
commit 427aaa7713

@ -27,6 +27,7 @@ func Command(name string, arg ...string) (*exec.Cmd, error) {
// registered in the command.
func Apply(cmd *exec.Cmd) error {
uid := os.Getuid()
gid := os.Getgid()
// If the user is already root, there's no need for fakeroot
if uid == 0 {
@ -59,7 +60,7 @@ func Apply(cmd *exec.Cmd) error {
cmd.SysProcAttr.GidMappings = append(cmd.SysProcAttr.GidMappings, syscall.SysProcIDMap{
ContainerID: 0,
HostID: uid,
HostID: gid,
Size: 1,
})