containerd / continuity

A transport-agnostic, filesystem metadata manifest system
https://containerd.io
Apache License 2.0
141 stars 67 forks source link

Resolve context root on context.Walk when root is symlink #113

Closed darstahl closed 6 years ago

darstahl commented 6 years ago

When the root of a context is a symlink, Walk does not walk the contents of the directory as expected due to the implementation in Golang. This expands the root of a context to the target of the link prior to the walk in order to correctly walk the contents of the context.

Readlink was forked on Windows as there is a bug in Golang that prevents Volume GUID paths of the form \??\Volume from being a valid target of a link. This type of path is necessary for mounted VHDs of Windows container filesystems.

Signed-off-by: Darren Stahl darst@microsoft.com

dmcgowan commented 6 years ago

Are you opening up an upstream change to fix the ReadLink issue? sysx is intended to only have temporary changes before they are upstreamed to https://github.com/golang/sys.

darstahl commented 6 years ago

Yes, the changes will be submitted to Go's Syscall package. The current state of https://github.com/golang/sys syscall package is not up to date with Go master (which contains the patch that broke this), so I'm not sure if this change will land in sys or syscall or both. It is intended to be upstreamed though, and this is just a temporary fork.

crosbymichael commented 6 years ago

LGTM

dmcgowan commented 6 years ago

LGTM

kolyshkin commented 6 years ago

Yes, the changes will be submitted to Go's Syscall package.

@darstahl can you please point out to those? I did a quick look and can't seem to find any.

kolyshkin commented 4 years ago

Found myself re-reading this today :) If anyone knows if the Windows' readlink bug is fixed in golang, please share the news

kolyshkin commented 4 years ago

Guess what, I found the issue (https://github.com/golang/go/issues/30463) and the fix (https://go-review.googlesource.com/c/go/+/164201, very similar to what we have in here).

Will follow up with the clean patch