From de251b6935f10d6bdb8f91b7a78afbfda721caed Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 6 May 2024 11:26:19 +0200 Subject: [PATCH] gen-manifests: derrive seedArg from filename and env To ensure that manifests get random(ish) and stable UUIDs we set the rng seed arg based on the filename. This should fix the issue discovered in osbuild/manifest-db#124 that duplicated UUIDs for xfs/btrfs can trigger random(ish) and hard to diagnose errors. This is the same as https://github.com/osbuild/osbuild-composer/pull/4124 hopefully for the right place this time. --- cmd/gen-manifests/main.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cmd/gen-manifests/main.go b/cmd/gen-manifests/main.go index a401a33667..ad83a88a8d 100644 --- a/cmd/gen-manifests/main.go +++ b/cmd/gen-manifests/main.go @@ -210,6 +210,14 @@ func makeManifestJob( filename := fmt.Sprintf("%s-%s-%s-%s.json", u(distroName), u(archName), u(imgType.Name()), u(name)) cacheDir := filepath.Join(cacheRoot, archName+distribution.Name()) + // ensure that each file has a unique seed based on filename + hash := func(s string) int64 { + h := fnv.New64() + h.Write([]byte(filename)) + return int64(h.Sum64()) + } + seedArg += hash(filename) + options := bc.Options var bp blueprint.Blueprint