Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fsutil error expected single entry #2207

Closed
crazy-max opened this issue Jan 24, 2024 · 6 comments · Fixed by tonistiigi/fsutil#187
Closed

fsutil error expected single entry #2207

crazy-max opened this issue Jan 24, 2024 · 6 comments · Fixed by tonistiigi/fsutil#187
Labels

Comments

@crazy-max
Copy link
Member

Repro on master (7e4021a) on a Windows machine when building https://github.com/dockersamples/avatars:

> docker buildx build -f ./deploy/web.dockerfile .
[+] Building 0.0s (0/0)  docker:default
[+] Building 0.7s (5/9)                                                                                              docker:default
 => [internal] load build definition from web.dockerfile                                                                       0.0s
 => => transferring dockerfile: 335B                                                                                           0.0s
 => [internal] load metadata for docker.io/library/node:18-bullseye-slim                                                       0.6s
 => [internal] load .dockerignore                                                                                              0.0s
 => => transferring context: 58B                                                                                               0.0s
 => ERROR [internal] load build context                                                                                        0.0s
 => => transferring context:                                                                                                   0.0s
 => [stage-0 1/5] FROM docker.io/library/node:18-bullseye-slim@sha256:f06f9ff9dcc5cfec936a7bf08580c5d9cf0f424fbbd857d3677cff5  0.0s
------
 > [internal] load build context:
------
ERROR: failed to solve: rpc error: code = Unknown desc = expected single entry "web\\package.json" but got "web/package.json"

Might be related to tonistiigi/fsutil#167 (tonistiigi/fsutil@36ef4d8...f098008#diff-0ecba5c38a48c9edee18cf59877735dbc0036535be4a4af3d797b45c5862c71fR150) (cc @jedevc)

I looked at running fsutil tests on Windows and found tonistiigi/fsutil#173 (comment)

@crazy-max crazy-max added kind/bug Something isn't working area/build labels Jan 24, 2024
@crazy-max
Copy link
Member Author

crazy-max commented Jan 24, 2024

This patch seems to fix the issue crazy-max/fsutil@b3997ab (didn't test all cases atm)

@jedevc
Copy link
Collaborator

jedevc commented Jan 24, 2024

Aha, yeah, that definitely looks like the right fix. The expected single entry message is pretty much just an internal failure message - it means we tried to get info for a file, but the info we got back was for a different file, which is pretty weird (so erroring makes sense).

Maybe we should annotate the error there that indicates that this is unexpected and internal? Instead of a genuine error that the library consumer can be expected to handle.

@tonistiigi
Copy link
Member

tonistiigi/fsutil#167 (review) still needs a follow-up as well I think. This Walk to get a Stat pattern does not make sense afaics (and seems to be error-prone).

@crazy-max
Copy link
Member Author

crazy-max commented Jan 24, 2024

@glours Use this branch for your patch in compose: tonistiigi/fsutil@master...crazy-max:fsutil:toslash-keep-gogo

It reverts gogo removal to avoid breaking compat in compose related to buildx vendoring.

replace github.com/tonistiigi/fsutil => github.com/crazy-max/fsutil v0.0.0-20240124164449-376dc28ff40f

@jedevc
Copy link
Collaborator

jedevc commented Jan 24, 2024

tonistiigi/fsutil#167 (review) still needs a follow-up as well I think. This Walk to get a Stat pattern does not make sense afaics (and seems to be error-prone).

Maybe. I remember a discussion about this on slack/sync, I no longer have access. The problem is that, when filtering files, if a directory had all of it's contents excluded it would never get walked (or something like this). This means that calling Stat on that directory is a bit tricky - we don't want to be able to return Stat on a directory that "doesn't exist" according to Walk. I remember coming up with some bizarre workarounds to handle this (like a "ghost directory" 👻)

We could define Stat on the FS, but I think for FilterFS at least, we need to have the same Walk logic to make sure it "exists".

Obviously this could be massively simplified if we removed the assumption that empty directories are just removed - but this is the implication of doing the lazy evaluation of the parent paths. Not sure exactly why we do this, but if we could change this, then I think we might actually be able to entirely remove our custom FS interface and replace it with the Go FS interface?

(sorry, I've kind of lost a lot of the context for this)

crazy-max added a commit to crazy-max/compose that referenced this issue Jan 30, 2024
Commit 7781b7c vendoring buildx master introduced a regression
with a bump of the peer dependency github.com/tonistiigi/fsutil.
full diff: tonistiigi/fsutil@36ef4d8...f098008

When bisecting, tonistiigi/fsutil#167 is the PR introducing the
regression.

We got a similar issue reported before DD 4.27 (docker/buildx#2207)
that was fixed with tonistiigi/fsutil@master...crazy-max:fsutil:toslash-keep-gogo
but Windows users encountered another new issue also related to fsutil.

While a fix is being worked on fsutil repo to address this issue, I have
created a branch that reverts this change in fsutil.

This branch for buildkit https://github.com/crazy-max/buildkit/tree/compose-957cb50df991
has been created at the regression point and reverts moby/buildkit#4094.
Another branch for buildx https://github.com/crazy-max/buildx/tree/compose-617f538cb315
has been created as well to vendor the buildkit branch and replace
both buildkit and fsutil to the right commit.

Signed-off-by: CrazyMax <[email protected]>
crazy-max added a commit to crazy-max/compose that referenced this issue Jan 30, 2024
Commit 7781b7c vendoring buildx master introduced a regression
with a bump of the peer dependency github.com/tonistiigi/fsutil.
full diff: tonistiigi/fsutil@36ef4d8...f098008

When bisecting, tonistiigi/fsutil#167 is the PR introducing the
regression.

We got a similar issue reported before DD 4.27 (docker/buildx#2207)
that was fixed with tonistiigi/fsutil@master...crazy-max:fsutil:toslash-keep-gogo
but Windows users encountered another new issue also related to fsutil.

While a fix is being worked on fsutil repo to address this issue, I have
created a branch that reverts this change in fsutil.

This branch for buildkit https://github.com/crazy-max/buildkit/tree/compose-957cb50df991
has been created at the regression point and reverts moby/buildkit#4094.

Signed-off-by: CrazyMax <[email protected]>
@crazy-max
Copy link
Member Author

With latest changes from fsutil tonistiigi/fsutil@35e1166, I have another error which seems to be on the receiver side:

> docker buildx build -f ./deploy/web.dockerfile .
[+] Building 0.0s (0/0)  docker:default
2024/02/21 17:57:36 http2: server: error reading preface from client //./pipe/docker_engine: file has already been close[+] Building 0.6s (7/9)                                                                                  docker:default
 => [internal] load build definition from web.dockerfile                                                           0.0s
 => => transferring dockerfile: 335B                                                                               0.0s
 => [internal] load metadata for docker.io/library/node:18-bullseye-slim                                           0.4s
 => [internal] load .dockerignore                                                                                  0.0s
 => => transferring context: 58B                                                                                   0.0s
 => [stage-0 1/5] FROM docker.io/library/node:18-bullseye-slim@sha256:0a35c023e8b2a44e5c6a22714eb13b45d9c26307a13  0.0s
 => [internal] load build context                                                                                  0.1s
 => => transferring context: 62.41kB                                                                               0.0s
 => CACHED [stage-0 2/5] WORKDIR /app                                                                              0.0s
 => ERROR [stage-0 3/5] COPY web/package.json web/yarn.lock ./                                                     0.0s
------
 > [stage-0 3/5] COPY web/package.json web/yarn.lock ./:
------
web.dockerfile:8
--------------------
   6 |
   7 |     # install dependencies
   8 | >>> COPY web/package.json web/yarn.lock ./
   9 |     RUN --mount=type=cache,target=/cache/yarn \
  10 |       yarn install
--------------------
ERROR: failed to solve: failed to compute cache key: failed to calculate checksum of ref b5835101-3195-42d3-8b06-35d8de84ee90::p5ufq4sjb4lus5xke23imppgr: "/web/yarn.lock": not found

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants