Set file attributes before setting mode and owner.

This commit is contained in:
2023-10-05 16:30:55 -05:00
parent 1e045c2320
commit 52e511d5f3

View File

@@ -591,6 +591,10 @@ func (entry *Entry) RestoreMetadata(fullPath string, fileInfo *os.FileInfo, setO
}
}
if entry.Attributes != nil && len(*entry.Attributes) > 0 {
entry.SetAttributesToFile(fullPath)
}
// Note that chown can remove setuid/setgid bits so should be called before chmod
if setOwner {
if !SetOwner(fullPath, entry, fileInfo) {
@@ -617,9 +621,10 @@ func (entry *Entry) RestoreMetadata(fullPath string, fileInfo *os.FileInfo, setO
}
}
if entry.Attributes != nil && len(*entry.Attributes) > 0 {
entry.SetAttributesToFile(fullPath)
}
// TODO Set flags last
// if entry.Attributes != nil && len(*entry.Attributes) > 0 {
// entry.SetFlagsToFile(fullPath)
// }
return true
}