Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove direct dependency on github.com/pkg/errors #185

Merged
merged 2 commits into from Sep 14, 2021

Conversation

AkihiroSuda
Copy link
Member

No description provided.

@AkihiroSuda
Copy link
Member Author

AkihiroSuda commented Aug 22, 2021

I suggest releasing v0.2.0 after merging this

@AkihiroSuda AkihiroSuda changed the title remove direct dependency on github.com/pkg/errors @AkihiroSuda Run go fmt with Go 1.17 + Remove direct dependency on github.com/pkg/errors Aug 22, 2021
@AkihiroSuda AkihiroSuda changed the title @AkihiroSuda Run go fmt with Go 1.17 + Remove direct dependency on github.com/pkg/errors Run go fmt with Go 1.17 + Remove direct dependency on github.com/pkg/errors Aug 22, 2021
@AkihiroSuda AkihiroSuda changed the title Run go fmt with Go 1.17 + Remove direct dependency on github.com/pkg/errors Remove direct dependency on github.com/pkg/errors Aug 22, 2021
@estesp
Copy link
Member

estesp commented Sep 10, 2021

oops; generated a conflict from the other PR; needs rebase

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
@AkihiroSuda
Copy link
Member Author

rebased

Copy link
Member

@estesp estesp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dmcgowan dmcgowan merged commit 7e9eee8 into containerd:main Sep 14, 2021
@AkihiroSuda
Copy link
Member Author

}
default:
// TODO: Support pipes and sockets
return errors.Wrapf(err, "unsupported mode %s", fi.Mode())
return fmt.Errorf("unsupported mode %s: %w", fi.Mode(), err)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has broken the native snapshotter moby/buildkit#2747

While the new code that passes %w as nil is definitely wrong, there is a behavior change here as well. The previous code(that also was wrong) called Wrap(nil) in here so returned out nil in the middle of a directory, leaving the snapshot is some undefined state. The new code returns an incorrectly formatted error.

I think the correct and backward compatible change is to skip the item, maybe print a log. (edit: creating a stub file instead of skipping might be even better).

Also, changes to these errors in continuity and later in containerd itself have completely broken the buildkit's and docker's stacktrace feature for any errors propagating from containerd, without any meaningful benefit afaics. The error reporting and debugging experience is very poor now. Go stdlib has not implemented a replacement for pkg/errors.

Eg. with this change the report for this error becomes.

error: failed to solve: failed to compute cache key: copying of parent failed: unsupported mode prw-------: %!w(<nil>)
1 v0.9.0-162-g7b171f6b buildkitd --oci-worker-snapshotter=native
github.com/containerd/containerd/snapshots/native.(*snapshotter).createSnapshot
	/src/vendor/github.com/containerd/containerd/snapshots/native/native.go:284
github.com/containerd/containerd/snapshots/native.(*snapshotter).Prepare
	/src/vendor/github.com/containerd/containerd/snapshots/native/native.go:121
github.com/containerd/containerd/metadata.(*snapshotter).createSnapshot
	/src/vendor/github.com/containerd/containerd/metadata/snapshot.go:357
github.com/containerd/containerd/metadata.(*snapshotter).Prepare
	/src/vendor/github.com/containerd/containerd/metadata/snapshot.go:277
github.com/moby/buildkit/snapshot/containerd.(*nsSnapshotter).Prepare
	/src/snapshot/containerd/snapshotter.go:47
github.com/moby/buildkit/snapshot.(*fromContainerd).Prepare
	/src/snapshot/snapshotter.go:59
github.com/moby/buildkit/cache.(*immutableRef).extract.func1
	/src/cache/refs.go:734
github.com/moby/buildkit/util/flightcontrol.(*call).run
	/src/util/flightcontrol/flightcontrol.go:121
sync.(*Once).doSlow
	/usr/local/go/src/sync/once.go:68
sync.(*Once).Do
	/usr/local/go/src/sync/once.go:59
runtime.goexit
	/usr/local/go/src/runtime/asm_arm64.s:1133
  
1 v0.9.0-162-g7b171f6b buildkitd --oci-worker-snapshotter=native
github.com/moby/buildkit/solver.(*edge).createInputRequests.func1.1
	/src/solver/edge.go:834
github.com/moby/buildkit/solver/internal/pipe.NewWithFunction.func2
	/src/solver/internal/pipe/pipe.go:82
runtime.goexit
	/usr/local/go/src/runtime/asm_arm64.s:1133

native/native.go:284 is the call to CopyDir() so everything inside continuity is skipped.

Now when similar change in containerd is included as well we don't get any information for the real error location at all.

1 v0.10.0 buildkitd --oci-worker-snapshotter=native
github.com/moby/buildkit/solver.(*edge).createInputRequests.func1.1
	/src/solver/edge.go:837
github.com/moby/buildkit/solver/internal/pipe.NewWithFunction.func2
	/src/solver/internal/pipe/pipe.go:82
runtime.goexit
	/usr/local/go/src/runtime/asm_arm64.s:1133

I'd suggest reverting all of these changes.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Workaround to fix the nil wrapping: #196

I think the correct and backward compatible change is to skip the item, maybe print a log. (edit: creating a stub file instead of skipping might be even better).

I guess this can be discussed later in a separate issue/PR

I'd suggest reverting all of these changes.

This is hard, as https://github.com/pkg/errors has been already archived.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

creating a stub file instead of skipping might be even better

done:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants