Skip to content

Commit 7aaa8fc

Browse files
Merge pull request #3751 from AkihiroSuda/native-copydir-allow-xattr-errors-1.3
[release/1.3] snapshots/native: ignore xattr errors during CopyDir
2 parents 1c3929e + f6a32a7 commit 7aaa8fc

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)