chunked: ignore security.selinux

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
Giuseppe Scrivano 2021-11-26 11:00:19 +01:00
parent ef21a2a795
commit 7f147b05f5
1 changed files with 7 additions and 4 deletions

View File

@ -57,6 +57,10 @@ type chunkedDiffer struct {
gzipReader *pgzip.Reader
}
var xattrsToIgnore = map[string]interface{}{
"security.selinux": true,
}
func timeToTimespec(time time.Time) (ts unix.Timespec) {
if time.IsZero() {
// Return UTIME_OMIT special value
@ -280,10 +284,6 @@ func canDedupFileWithHardLink(file *internal.FileMetadata, fd int, s os.FileInfo
return false
}
xattrsToIgnore := map[string]interface{}{
"security.selinux": true,
}
xattrs := make(map[string]string)
for _, x := range listXattrs {
v, err := system.Lgetxattr(path, x)
@ -578,6 +578,9 @@ func setFileAttrs(dirfd int, file *os.File, mode os.FileMode, metadata *internal
}
for k, v := range metadata.Xattrs {
if _, found := xattrsToIgnore[k]; found {
continue
}
data, err := base64.StdEncoding.DecodeString(v)
if err != nil {
return fmt.Errorf("decode xattr %q: %v", v, err)