containerd / containerd/continuity

`continuity.context.Walk` assumes incorrect behavior for `os.Readlink`

Open
#232 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
153
Forks
74
PR merge metrics
No merged PRs in 30d

Description

The code added in https://github.com/containerd/continuity/commit/8100e750d9eddde6410d2b8aa00fd0fbd1ada652 (CC @darstahl) appears to be assuming a behavior of `os.Readlink` that it does not actually provide, which will almost certainly cause `Walk` to fail when the root is a relative symlink or symlink-to-symlink on POSIX platforms.
- (See https://github.com/golang/go/issues/57766.)

A cleaner fix here is to ensure that the root path passed to `filepath.Walk` and/or `filepath.WalkDir` ends with a trailing separator, which (on all POSIX-compliant platforms, and Windows as of https://go.dev/cl/463177) will cause `Walk` to start walking at the target referred to by the root instead of the root symlink itself.
- (See https://go.dev/cl/484475 for an example of such a change.)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.