mirror of
https://github.com/moby/moby.git
synced 2026-08-09 09:33:50 +00:00
CopyFromContainer (and stat) with a source path that ends with a
trailing separator asserts a directory, and must error when the path
resolves to a non-directory. The daemon relied on os.Lstat rejecting
the trailing separator, which the windowsfilter volume mount
(\\?\Volume{GUID}\) does, but the containerd snapshotter's plain
directory mount does not - so the trailing separator was silently
ignored and a file was returned instead of an error.
Enforce the invariant explicitly in StatPath, returning a consistent
"not a directory" error across storage drivers (matching the ENOTDIR
behaviour on Linux), add tests, and un-skip
TestCopyFromContainerPathIsNotDir.
Signed-off-by: Dawei Wei <wei.dawei.cn@gmail.com>