Skip to content

Commit

Permalink
allow xattr error
Browse files Browse the repository at this point in the history
This commit allows ignoring errors during copying xattr like security.selinux,
which is not always supported.

Reported in several issues including
* openfaas/openfaas-cloud#312
* moby/buildkit#704
* genuinetools/img#45
* https://bugzilla.redhat.com/show_bug.cgi?id=1596918

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
  • Loading branch information
AkihiroSuda committed Oct 31, 2018
1 parent bb4d60e commit 2d5b6cb
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 50 deletions.
11 changes: 8 additions & 3 deletions cmd/copy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,15 @@ func runCopy(ctx context.Context, args []string, opt opts) error {
}

func runCp(ctx context.Context, srcs []string, dest string, opt opts) error {
xattrErrorHandler := func(dst, src, key string, err error) error {
log.Println(err)
return nil
}
for _, src := range srcs {
if err := copy.Copy(ctx, src, dest, copy.AllowWildcards, func(ci *copy.CopyInfo) {
ci.Chown = opt.chown
}); err != nil {
if err := copy.Copy(ctx, src, dest, copy.AllowWildcards, copy.WithXAttrErrorHandler(xattrErrorHandler),
func(ci *copy.CopyInfo) {
ci.Chown = opt.chown
}); err != nil {
return errors.Wrapf(err, "failed to copy %s to %s", src, dest)
}
}
Expand Down
2 changes: 1 addition & 1 deletion vendor.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
github.com/moby/buildkit 277037a77f32b689df342c2ac7ea1c093be4b52e
github.com/tonistiigi/fsutil ecf259bc9d815143037535521910285f47f321ef
github.com/tonistiigi/fsutil 11b4bc7505e4558833cf30344d84e225766b21c1
github.com/containerd/continuity c6cef34830231743494fe2969284df7b82cc0ad0
github.com/pkg/errors e881fd58d78e04cf6d0de1217f8707c8cc2249bc
github.com/containerd/containerd 1a560540b9a1ab7dcdf657502b2f4db0ae067b30
Expand Down
38 changes: 30 additions & 8 deletions vendor/github.com/tonistiigi/fsutil/copy/copy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 0 additions & 19 deletions vendor/github.com/tonistiigi/fsutil/copy/copy_linux.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions vendor/github.com/tonistiigi/fsutil/copy/copy_nowindows.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 0 additions & 19 deletions vendor/github.com/tonistiigi/fsutil/copy/copy_unix.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2d5b6cb

Please sign in to comment.