Skip to content

WCOW/dockerfile fontend: consistency in handling slashes slashes in C:\\ #4696

@profnandaa

Description

@profnandaa

I have noticed we have some inconsistencies on how the dockerfile frontend handles the paths for Windows. I'm opening this issue quickly to track this but I'll provide better details with more tests.

So far, I've noticed this with COPY, but I need to do more tests.

Repro Steps

Dockerfile:

FROM mcr.microsoft.com/windows/nanoserver:ltsc2022
COPY hello.txt C:\
CMD ["cmd", "/C", "type C:\\hello.txt"]

Build command:

buildctl build `
    --frontend=dockerfile.v0 `
    --local context=. \ `
    --local dockerfile=. `
    --output type=image,name=docker.io/janedoe/hello-buildkit,push=false

Expected error:

[+] Building 0.3s (2/2) FINISHED
 => [internal] load build definition from Dockerfile                                                                                    0.0s
 => => transferring dockerfile: 160B                                                                                                    0.0s
 => [internal] load metadata for mcr.microsoft.com/windows/nanoserver:ltsc2022                                                          0.1s
Dockerfile:2
--------------------
   1 |         FROM mcr.microsoft.com/windows/nanoserver:ltsc2022
   2 | >>>     COPY hello.txt C:\
   3 | >>>     CMD ["cmd", "/C", "type C:\\hello.txt"]
   4 |
--------------------
error: failed to solve: failed to process "\"type": unexpected end of statement while looking for matching double-quote

Current Fix/Work-around

General rule of thumb: Use / instead of \ for paths, for a consistent experience.
For the above error, changing C:\ in COPY stanza to C:/ fixes it.

/cc. @gabriel-samfira

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions