-
Notifications
You must be signed in to change notification settings - Fork 762
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
copier.Put: check for is-not-a-directory using lstat, not stat #3658
copier.Put: check for is-not-a-directory using lstat, not stat #3658
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: nalind The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
When checking if something that we want to overwrite with a directory is already a directory or not, use lstat instead of stat. If it's a symbolic link, it's not a directory. This is a subtle behavior change, but it's in line with docker build. Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
7ed945b
to
7631600
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thank you, @nalind. You're impressively fast!
(added to the release note) |
/lgtm |
/hold cancel |
Hey there - I've noticed a change between I have a multi-stage Container-file which imports a couple of images, then creates a final image from The description says:
… which I read as It's an easy fix (… once I'd figured out the problem, which took a while!) but I just wanted to check this was an intentional effect of this change, rather than a missed edge-case? (… should the copy fail if there's ambiguity such as this? Arguably, the new behaviour silently fails part of the |
@nalind ^^ |
Can you elaborate a bit more on the case? How did you copy a symlink over a directory? If the source specified for COPY is a symbolic link, it's dereferenced, so I'm having trouble reproducing what you're describing. |
Here's the commit which fixed the issue: srcshelton/docker-gentoo-build@e76b152 The first base-image ( The second base-image ( Up to I've ben able to fix this change be swapping the order of the |
Yes, if a path in the first set of files copied was a symbolic link, and in the second set of files copied it was a directory, the expectation is that the symlink is replaced with the directory. It looks like the version before the commit copied a directory tree from the first ("zxtm", where |
What type of PR is this?
/kind bug
What this PR does / why we need it:
When checking if something that we want to overwrite with a directory is already a directory or not, use lstat instead of stat. If it's a symbolic link, it's not a directory.
This is a subtle behavior change, but it's in line with docker build.
How to verify it
A slightly longer unit test!
New conformance test!
Which issue(s) this PR fixes:
Follow up to #3655 and #3656.
Special notes for your reviewer:
Does this PR introduce a user-facing change?