1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/integration/build
Sebastiaan van Stijn 5858a99267
Builder: fix "COPY --from" to non-existing directory on Windows
This fixes a regression introduced in 6d87f19142,
causing `COPY --from` to fail if the target directory does not exist:

```
FROM mcr.microsoft.com/windows/servercore:ltsc2019 as s1
RUN echo "Hello World" > /hello

FROM mcr.microsoft.com/windows/servercore:ltsc2019
COPY --from=s1 /hello /hello/another/world
```

Would produce an error:

```
Step 4/4 : COPY --from=s1 /hello /hello/another/world
failed to copy files: mkdir \\?: The filename, directory name, or volume label syntax is incorrect.
```

The cause for this was that Go's `os.MkdirAll()` does not support/detect volume GUID paths
(`\\?\Volume{dae8d3ac-b9a1-11e9-88eb-e8554b2ba1db}\hello\another}`), and as a result
attempted to create the volume as a directory (`\\?`), causing it to fail.

This patch replaces `os.MkdirAll()` with our own `system.MkdirAll()` function, which
is capable of detecting GUID volumes.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-08-08 16:45:10 +02:00
..
testdata Builder: fix "COPY --from" to non-existing directory on Windows 2019-08-08 16:45:10 +02:00
build_cgroupns_linux_test.go Make cgroup namespaces configurable 2019-05-07 10:22:16 -07:00
build_session_test.go integration: run build session tests on non-experimental 2019-07-17 23:56:04 +02:00
build_squash_test.go integration: change container.Run signature to fix linting 2019-06-07 13:05:26 +02:00
build_test.go Builder: fix "COPY --from" to non-existing directory on Windows 2019-08-08 16:45:10 +02:00
main_test.go Add canonical import comment 2018-02-05 16:51:57 -05:00