Skip to content

Commit f6a32a7

Browse files
committed
snapshots/native: ignore xattr errors during CopyDir
`secuity.*` xattrs cannot be copied in most cases For moby/buildkit#1189 Signed-off-by: Akihiro Suda <[email protected]> (cherry picked from commit d52cbc1) Signed-off-by: Akihiro Suda <[email protected]>
1 parent 3866900 commit f6a32a7

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

snapshots/native/native.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,15 @@ func (o *snapshotter) createSnapshot(ctx context.Context, kind snapshots.Kind, k
286286
if td != "" {
287287
if len(s.ParentIDs) > 0 {
288288
parent := o.getSnapshotDir(s.ParentIDs[0])
289-
if err := fs.CopyDir(td, parent); err != nil {
289+
xattrErrorHandler := func(dst, src, xattrKey string, copyErr error) error {
290+
// security.* xattr cannot be copied in most cases (moby/buildkit#1189)
291+
log.G(ctx).WithError(copyErr).Debugf("failed to copy xattr %q", xattrKey)
292+
return nil
293+
}
294+
copyDirOpts := []fs.CopyDirOpt{
295+
fs.WithXAttrErrorHandler(xattrErrorHandler),
296+
}
297+
if err := fs.CopyDir(td, parent, copyDirOpts...); err != nil {
290298
return nil, errors.Wrap(err, "copying of parent failed")
291299
}
292300
}

0 commit comments

Comments
 (0)