Set correct ownership during package extraction

This commit is contained in:
2025-08-01 19:19:08 +03:00
parent 6492fd028f
commit e63398c853
+10
View File
@@ -596,6 +596,11 @@ func extractPackage(bpmpkg *BPMPackage, verbose bool, filename, rootDir string)
return err return err
} }
err = os.Chown(extractFilename, header.Uid, header.Gid)
if err != nil {
return err
}
// Using syscall instead of os.Chmod because it seems to strip the setuid, setgid and sticky bits // Using syscall instead of os.Chmod because it seems to strip the setuid, setgid and sticky bits
err := syscall.Chmod(extractFilename, uint32(header.Mode)) err := syscall.Chmod(extractFilename, uint32(header.Mode))
if err != nil { if err != nil {
@@ -647,6 +652,11 @@ func extractPackage(bpmpkg *BPMPackage, verbose bool, filename, rootDir string)
return err return err
} }
err = os.Chown(extractFilename, header.Uid, header.Gid)
if err != nil {
return err
}
// Using syscall instead of os.Chmod because it seems to strip the setuid, setgid and sticky bits // Using syscall instead of os.Chmod because it seems to strip the setuid, setgid and sticky bits
err = syscall.Chmod(extractFilename, uint32(header.Mode)) err = syscall.Chmod(extractFilename, uint32(header.Mode))
if err != nil { if err != nil {