Skip to content

tarconv: keep a layer's own entries under its opaque directory - #354

Open
dmcgowan wants to merge 1 commit into
containerd:mainfrom
dmcgowan:tarconv-fixes
Open

dmcgowan wants to merge 1 commit into
containerd:mainfrom
dmcgowan:tarconv-fixes

Conversation

@dmcgowan

@dmcgowan dmcgowan commented Dec 1, 2026

Copy link
Copy Markdown
Member

In merge mode (WithMerge), an opaque marker removed everything beneath its
directory. That included entries the same layer wrote in that directory before
the marker, such as names starting with -, which sort before ..

Apply now records the names the layer wrote in each directory on the path of
its latest entry. When an opaque marker appears in one of those directories,
those names are kept and only entries from earlier layers are removed. A
subdirectory the layer wrote entries in without an entry of its own is recorded
in the list of its parent. Tar streams group the entries of a directory
together, with the entries of its subdirectories among them, so the list of a
directory is dropped once the stream moves on to a sibling of it. An opaque
marker that comes after the stream has left its directory is not supported.

Testing

  • TestMergeOpaqueAfterEntries: an opaque marker keeps the layer's own earlier
    entries in the directory, including subdirectories with or without an entry
    of their own and a nested opaque directory, and removes the lower layers'
    files and subdirectories.
  • go test ./tarconv/ ./fs/... passes.

In merge mode an opaque marker removed every entry beneath its
directory, including entries the same layer wrote in that directory
before the marker. Record the names of the entries the layer wrote in
each directory on the path of its latest entry, and keep those when an
opaque marker in that directory removes the entries of earlier layers.
A subdirectory the layer wrote entries in without an entry of its own
is recorded in the list of its parent.

Tar streams group the entries of a directory together, with the entries
of its subdirectories among them. The list of a directory is dropped
once the stream moves on to a sibling of it. An opaque marker that
comes after the stream has left its directory is not supported.

Signed-off-by: Derek McGowan <derek@mcg.dev>
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.

1 participant