Repository navigation
fix(layercopy): preserve source visibility bounds - #13848
Merged
Merged
Conversation
Carry the lowest visible overlay layer through recursive source walks so opaque directories and non-directory entries continue hiding lower-layer descendants. Initialize the bound from ancestors of a selected source subtree. Signed-off-by: Erik Sipsma <[email protected]>
Stop source traversal before reading non-directory overlay entries so symlink targets cannot contribute contents that the kernel overlay view hides. Signed-off-by: Erik Sipsma <[email protected]>
Reuse cumulative ancestor visibility floors across copies from the same mounted overlay source. This avoids rescanning shared ancestor paths for every wildcard match while keeping cache state scoped to one Copier. Signed-off-by: Erik Sipsma <[email protected]>
Signed-off-by: Erik Sipsma <[email protected]>
sipsma
force-pushed
the
dagger-issue-13844-lead-aa1e1ba2
branch
from
August 6, 2026 02:15
cbb8424 to
c195598
Compare
grouville
self-requested a review
August 6, 2026 05:50
grouville
approved these changes
Aug 6, 2026
marcosnils
pushed a commit
to marcosnils/dagger
that referenced
this pull request
Aug 24, 2026
(cherry picked from commit 5e9d3b4) Signed-off-by: Marcos Lilljedahl <[email protected]>
marcosnils
pushed a commit
to marcosnils/dagger
that referenced
this pull request
Aug 24, 2026
(cherry picked from commit 5e9d3b4) Signed-off-by: Marcos Lilljedahl <[email protected]>
marcosnils
pushed a commit
to marcosnils/dagger
that referenced
this pull request
Aug 25, 2026
(cherry picked from commit 5e9d3b4) Signed-off-by: Marcos Lilljedahl <[email protected]>
marcosnils
pushed a commit
that referenced
this pull request
Aug 25, 2026
(cherry picked from commit 5e9d3b4) Signed-off-by: Marcos Lilljedahl <[email protected]>
This was referenced Aug 31, 2026
social4hyq
pushed a commit
to social4hyq/homebrew-core
that referenced
this pull request
Sep 20, 2026
dagger 0.21.9 Created-by: HarmonybrewBot Commit-by: HarmonybrewBot Merged-by: HarmonybrewBot Description: Created by `brew bump` --- Created with `brew bump-formula-pr`.<details> <summary>release notes</summary> <pre>## v0.21.9 - 2026-08-25 ### Added - Added SSHFS-backed volumes, allowing remote filesystems to be mounted into containers without copying their contents into Dagger's content store by @sipsma in dagger/dagger#13462 ### Fixed - `Container.withDirectory` and `Directory.withDirectory` no longer restore by @sipsma in dagger/dagger#13848 \ deleted nested files after execs remove and recreate an ancestor directory. - Engine client enumeration no longer blocks behind another session's by @sipsma in dagger/dagger#13542 \ initialization or teardown, preventing Cloud keeper heartbeats from stalling and live engines from being suspended. - Session teardown now runs in the background after the main client disconnects, by @sipsma in dagger/dagger#13681 \ preventing shutdown responses from timing out while the engine releases session-owned cache results. - The engine now bounds retained DAGQL cache metadata independently of disk by @sipsma in dagger/dagger#13846 \ usage by pruning cold persisted results when the structural estimate exceeds its configured limit. This may mitigate metadata growth at scale while preserving active and engine-lifetime cache roots. - Registry protocol probes no longer appear as scary errors in progress output by @vito in dagger/dagger#13410 \ when image pulls or publishes succeed, while genuine registry failures remain visible. - Registry authentication no longer invalidates downstream container cache reuse across sessions when applied before or after `Container.from` by @sipsma in dagger/dagger#13901 ### What to do next? - Read the [documentation](https://docs.dagger.io) - Join our [Discord server](https://discord.gg/dagger-io) - Follow us on [Twitter](https://twitter.com/dagger_io) </pre> <p>View the full release notes at <a href="https://github.com/dagger/dagger/releases/tag/v0.21.9">https://github.com/dagger/dagger/releases/tag/v0.21.9</a>.</p> </details> <hr> See merge request: Harmonybrew/homebrew-core!17786
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When an exec deletes and recreates a directory, copying that container
DirectorywithContainer.withDirectoryorDirectory.withDirectorycan restore files that only exist below the deleted directory in older snapshot layers.The mounted and exported views are correct because the kernel overlay mount already applies ancestor opacity and whiteouts. The bug is in layercopy's engine-side reconstruction: child directory walks could scan below the visibility bound established by an ancestor.
This change:
Lstatso physical source-layer symlinks are not followed;Copierand mounted source, avoiding repeated layer scans for wildcard copy roots.The cache does not change traversal results. In a local synthetic 500-match, 20-layer benchmark, it reduced repeated-copy time from roughly 0.5–0.6 seconds to 25–30 milliseconds, allocations from about 1.12 million to 132 thousand, and allocated bytes from about 99 MB to 7.7 MB per operation.
Validation
go test -count=1 ./util/layercopygo vet ./util/layercopydagger api call engine-dev test --pkg ./core/integration --run='Test(Directory|Container)/TestWithDirectory(OpaqueSourceAncestor|WhiteoutSourceAncestor|Union)?$'(14 passed using the source-built development engine)The new integration regressions verify that mounted/exported views exclude deleted files and that engine-side copies now produce the same contents. Before the fix, those controls passed while the engine-side copy assertions failed for both opaque-directory and separate-layer whiteout cases.
Fixes #13844