Hello Johannes, On 28/01/2022 20:22, Johannes Schauer Marin Rodrigues wrote:
Would you be willing to submit an updated patch containing the name and email of your choice and a commit message that explains your change? What you wrote above is a good explanation I think.
Attached is the updated patch. A commit message would be: <quote> This patch changes the behaviour of the cache directory filename calculation to be based on the "source" directory name, rather than being entirely random if the SOURCE_DATE_EPOCH[1] environment variable was determined to be present via getenv(3). The two main scenarios are covered by this patch: 1) Invocation of 'fc-cache' as a postinst step 2) Invocation of 'update-initramfs' as a postinst step where the initial ramdisk contains a font (e.g. when the plymouth hook calls 'fc-cache -s -y TEMPDIR') </quote> or much shorter: <quote>Generate deterministic cache directory filenames if SOURCE_DATE_EPOCH is set.
</quote> With kind regards, Roland Clobus
From: Roland Clobus <rclo...@rclobus.nl> Date: Sat 29 Jan 07:58:22 UTC 2022 Subject: [PATCH] Make the cache filenames determinstic Whilst working on the Reproducible Builds[0] effort, we noticed that fontconfig generates cache files with unreproducible/non-deterministic filenames. This is a supplement to the changes added in f098adac54ab where we ensured that the checksums themselves were determistic but the files that were stored in the cache directory are currently being given "random" names via uuid(3)'s uuid_generate_random function, thus any images that generate such files have different contents on every build. This patch changes the behaviour of the cache directory filename calculation to be based on the "source" directory name, rather than being entirely random if the SOURCE_DATE_EPOCH[1] environment variable was determined to be present via getenv(3). The two main scenarios are covered by this patch: 1) Invocation of 'fc-cache' as a postinst step 2) Invocation of 'update-initramfs' as a postinst step where the initial ramdisk contains a font (e.g. when the plymouth hook calls 'fc-cache -s -y TEMPDIR') This work is based on the patch written by Chris Lamb <ch...@chris-lamb.co.uk> who is sponsored by Tails[3]. [0] https://reproducible-builds.org/ [1] https://reproducible-builds.org/specs/source-date-epoch/ [2] https://bugs.debian.org/864082 [3] https://tails.boum.org/ Bug-Debian: http://bugs.debian.org/864082 --- src/fccache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Index: fontconfig-2.13.1/src/fccache.c =================================================================== --- fontconfig-2.13.1.orig/src/fccache.c +++ fontconfig-2.13.1/src/fccache.c @@ -101,7 +101,13 @@ FcDirCacheCreateUUID (FcChar8 *dir, ret = FcFalse; goto bail3; } - uuid_generate_random (uuid); + if (getenv("SOURCE_DATE_EPOCH")) + { + const uuid_t nil = { 0 }; + uuid_generate_sha1 (uuid, nil, (const char *)dir, strlen((const char *)dir)); + } + else + uuid_generate_random (uuid); if (force) hash_add = FcHashTableReplace; else
OpenPGP_signature
Description: OpenPGP digital signature