From ba9dc5d933a24bb3a3dcc39bdfb7e2121c1e8ac0 Mon Sep 17 00:00:00 2001 From: lczyk Date: Sat, 10 Oct 2026 13:09:02 +0100 Subject: [PATCH] fix: manifest attribution of until mutate listers for generated content When several slices list the same path and only some of them say "until: mutate", the path stays in the rootfs. Extracted content is then attributed in the manifest to the slices that did not say it, while generated content was attributed to every lister, including the ones that asked for the path to be removed. Generated content now follows the same rule as extracted content: a slice that says "until: mutate" is never an owner of the path in the manifest. No release branch has a generated path listed that way, so no published manifest changes. --- internal/slicer/slicer.go | 13 +++++++------ internal/slicer/slicer_test.go | 27 ++++++++++++++++++++++++++- 2 files changed, 33 insertions(+), 7 deletions(-) diff --git a/internal/slicer/slicer.go b/internal/slicer/slicer.go index ce791162..e54f8ad1 100644 --- a/internal/slicer/slicer.go +++ b/internal/slicer/slicer.go @@ -310,12 +310,13 @@ func Run(options *RunOptions) error { } // Do not add paths with "until: mutate". - if pathInfo.Until != setup.UntilMutate { - for _, slice := range slices { - err = report.Add(slice, entry) - if err != nil { - return err - } + for _, slice := range slices { + if slice.Contents[relPath].Until == setup.UntilMutate { + continue + } + err = report.Add(slice, entry) + if err != nil { + return err } } } diff --git a/internal/slicer/slicer_test.go b/internal/slicer/slicer_test.go index d6ef9ca0..aa809722 100644 --- a/internal/slicer/slicer_test.go +++ b/internal/slicer/slicer_test.go @@ -1351,7 +1351,32 @@ var slicerTests = []slicerTest{{ `, }, filesystem: map[string]string{"/file": "file 0644 2c26b46b"}, - manifestPaths: map[string]string{"/file": "file 0644 2c26b46b {test-package_myslice1,test-package_myslice2}"}, + manifestPaths: map[string]string{"/file": "file 0644 2c26b46b {test-package_myslice2}"}, +}, { + summary: "Extracted content in packages with until:mutate on one is attributed to the other", + slices: []setup.SliceKey{ + {"test-package", "myslice1"}, + {"test-package", "myslice2"}, + }, + release: map[string]string{ + "slices/mydir/test-package.yaml": ` + package: test-package + slices: + myslice1: + contents: + /dir/file: {until: mutate} + myslice2: + contents: + /dir/file: + `, + }, + filesystem: map[string]string{ + "/dir/": "dir 0755", + "/dir/file": "file 0644 cc55e2ec", + }, + manifestPaths: map[string]string{ + "/dir/file": "file 0644 cc55e2ec {test-package_myslice2}", + }, }, { summary: "Install two packages, both are recorded", slices: []setup.SliceKey{