Skip to content

mz868: tolerate dangling symlink when resolving COPY destination#869

Draft
mzihlmann wants to merge 2 commits into
mainfrom
mz868-copy-dangling-symlink-dest
Draft

mz868: tolerate dangling symlink when resolving COPY destination#869
mzihlmann wants to merge 2 commits into
mainfrom
mz868-copy-dangling-symlink-dest

Conversation

@mzihlmann

Copy link
Copy Markdown
Collaborator

Fixes #868

A COPY whose destination resolves through a dangling symlink aborted the build. resolveIfSymlink walks the destination and calls filepath.EvalSymlinks on the deepest existing component, which lstats the missing target of a dangling link and returns an error, surfaced as failed to eval symlinks. docker writes through the link instead and builds fine. This drives the walk off EvalSymlinks directly and treats its IsNotExist result, whether the path is missing or points through a dangling symlink, as a component to be created rather than a hard error, so the destination resolves to the lexical path and the copy proceeds.

@mzihlmann mzihlmann marked this pull request as draft July 3, 2026 16:45
@codecov

codecov Bot commented Jul 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.50000% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/commands/copy.go 87.50% 0 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

COPY through a dangling symlink destination aborts the build

1 participant