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

mutate.Extract will export wrong content when have a hard link and later modify it. (under special conditions) #2002

Open
hunshcn opened this issue Aug 18, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@hunshcn
Copy link

hunshcn commented Aug 18, 2024

Describe the bug

Make a file and create a hard link to it, if this file is not the first file in tar (In general, it is in dictionary order).
And then modify this file, the content from crane export of the hard link file will be wrong.

To Reproduce

FROM busybox

RUN echo 123 > t2
RUN ln t2 t1 && ln t2 t3
RUN echo 456 > t1
# prepare dockerfile
docker build . -t xxx
docker push xxx
crane export xxx image.tar && tar xf image.tar
cat t1 t2 t3

or I have built a image and pushed to dockerhub,
just use it

crane export hunsh/ggcr-extract-hardlink image.tar && tar xf image.tar
cat t1 t2 t3

will get output

456
123
456

Expected behavior

456
123
123

Additional context

It's related to #977

Add any other context about the problem here.

  • Output of crane version: 0.20.2
  • Registry used (e.g., GCR, ECR, Quay)
@hunshcn hunshcn added the bug Something isn't working label Aug 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant