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

Error when multiple hardlinked files are in the context directory on Linux on v0.13.0 and later #4831

Closed
alexander-rush opened this issue Apr 9, 2024 · 3 comments · Fixed by tonistiigi/fsutil#198 or #4870
Assignees
Milestone

Comments

@alexander-rush
Copy link

Hello, on Linux (Ubuntu 22.04 and 20.04) we have started seeing a problem in our Docker builds where multiple files hardlinked to the same inode in the same context directory will cause an error in the build. The problem only appears as of buildkit version 0.13 and later.

To reproduce (for some working directory tmp_dir) the error prepare a directory with two hardlinked files and a simple Dockerfile as follows,

mkdir {tmp_dir}/Scratch
cd {tmp_dir}/Scratch

cat <<EOF > Dockerfile
FROM alpine
ARG bin=bin
WORKDIR /app

ENTRYPOINT ["ls"]
CMD ["-ial"]

ADD \${bin} /app
EOF

mkdir bin
touch bim
ln bim bin/failplz

then invoke a build
sudo buildctl build --frontend gateway.v0 --opt source=docker/dockerfile --local context={tmp_dir}/Scratch/ --local dockerfile={tmp_dir}/Scratch
and observe the error Failed to solve: invalid link bin/failplz to unknown path: "bim".

This also happens when running docker build where docker-buildx-plugin has version 0.13.

Reproducing this issue is also dependent on the top-level filename. If I rename it to "bio" for example (lexicographically later than the "bin" directory) and hardlink from that the build succeeds.

It looks like this error only starts appearing as of #4094 and arises from within fsutil https://github.com/tonistiigi/fsutil/blob/master/hardlinks.go#L41.

Many thanks in advance.

@tonistiigi
Copy link
Member

@jedevc Can you check what's going on here?

@tonistiigi tonistiigi added this to the v0.13.2 milestone Apr 9, 2024
@jedevc
Copy link
Member

jedevc commented Apr 11, 2024

Yeah can do - this is on my list! I'm a little caught up in some other stuff right now, but will circle back to this as soon as I get a moment!

@tonistiigi
Copy link
Member

fix tonistiigi/fsutil#198

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