Re: [PATCH] Make the cache filenames determinstic

"Keith Packard" <[email protected]> Mon, 29 Oct 2018 20:49:45 -0700
Newsgroups gmane.comp.fonts.fontconfig
Message-ID <[email protected]>
Chris Lamb <[email protected]> writes:

> Hi fontconfig@,
>
> Whilst working on the Reproducible Builds[0] effort, we noticed that
> fontconfig generates cache files with unreproducible/non-deterministic
> filenames.

I've dug into this a bit more and I think an architectural change in the
cache files made last year is probably not what we want. That change has
the name of the cache file stored in each font directory in a .uuid
file. The patch you've proposed changes how the cache file name is
generated, but leaves it stored in the .uuid file. I'm thinking we
should revisit the whole .uuid file idea and go back to just using a
hash of the directory path for the cache file name. That eliminates the
.uuid file entirely, but does get us back to issues when font
directories move or are accessed under different path names.

To resolve (some of) those issues, I suggest that we adjust what path
name is used when generating the hash identifying the directory. There
are two important notions:

 1) Multiple pathnames reaching the same directory. Symlinks and
    relative paths could both happen here.

 2) FONTCONFIG_SYSROOT and other mechanisms for setting the sysroot
    value.

For 1), using 'realpath(3)' to generate a canonical path name
will make all paths to the same file end up with the same name.

For 2), using realpath(3) on FONTCONFIG_SYSROOT and then eliding that
from the start of the font path before computing the hash will mean that
you can generate a font cache with sysroot set and the resulting cache
will work on the target system.

This eliminates the variance seen with reproducible builds and
eliminates .uuid files cluttering up the disk and changing the contents
of what should be read-only data.

-- 
-keith

_______________________________________________
Fontconfig mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/fontconfig
signature.asc (application/pgp-signature, 832 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEw4O3eCVWE9/bQJ2R2yIaaQAAABEFAlvX1NkACgkQ2yIaaQAA
ABHY0w//bDVeHdrdmBYMa536NlQVRcYtgMC0hlWvaqVN3163BFjRjBuqONKlImvC
TQoS6a3sbl+ao+RxODlbsEWKFqTKJ4YcLfDFKDp3gT1b1TQ/9MFynmP0cHr3NJ2D
lsMXRGylIQ9fygEd+HgKwAKo7hYqa/vtp4bOL5/Cfp9Pc3fozLUBCrUx9A0o+C8C
44+Q4Lyo18LJZ00LfG1//AlHPGdGV62vw1LSVL3iLueeRCIPx2Sqoi+Bqsxv9SV2
od1XDkTjhGZFMeXSaM6UEBWBtEGFw8hLYtT/+kgS7VlBdiAPga1RPkfobAMRTJaQ
Udu8gJXZH646Ki3Oz0vfjN53OP9m4ySNQsMLvqud/7bc4gkAi4rMuqfDn03Sb4Og
dQev0EEB2Nnhzay3M9Z5n4MyZjlrLuJVqDX5CMfaLiWGPNVn7oV8UgqbB/iFBoqx
TOskCpiq7tQS/+SavtATy1Wa3qRSMvy84mZNUDobc51ixI8SKom4bGk21k60Y3eq
z/rDyFIr+gYnA8yyvRGZDGJ+tc0qJs3mvDwLOr/DLxPnqqId9b5sXEtbPn6sDDRP
Ifx8/EjsmH7/ahguQkC0vPC6gdJEXiGNWVdz8FehiomYxuh6EfMdqIB5qrHAvNx9
2ugp043OF6Tz4zMb7nrUrZkR9Ze+5nXxtL4xs2JSVA+6GP/JAUU=
=4I9G
-----END PGP SIGNATURE-----