Re: [PATCH] Make the cache filenames determinstic

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

> 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.

Oh, I forgot to mention that I've pushed a set of patches doing this to
my fontconfig fork on gitlab.freedesktop.org:

        https://gitlab.freedesktop.org/keithp/fontconfig

-- 
-keith

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

iQIzBAEBCAAdFiEEw4O3eCVWE9/bQJ2R2yIaaQAAABEFAlvX1SAACgkQ2yIaaQAA
ABGxfQ//fNJEOJ/qpoEGvK3DU8lQ6Ln/bQ0d+4AsaKsL7PBtxIiO87I8O/gMEeHh
5VlhYEEbCKCBm+NmJZKai4kWaZhKK16pUBHJXMUz9B3qnLvGD7sXYGQ8tPZsguxJ
NxHhmpi6da2HUi32oTRpXoExlCMyt8mMnhg8fhCzDzYL1zY542/rR7zTpvnep9kk
FDtc5tnunlBMx9KFABpjnWbnlCIIWszdqgzZOcL6gufHLVcwAEZTvrk5TpqEDQAs
bg7Bq2JlfHcUbJc5i0PUb8oSY+jqEm03vho4gW4LHbO98Gw6FT4mc0/iCoRTHs2I
M/OL85pjc/Hmfa4ZutoDlsRjMQU6+YgtRoot0JGoR+4IMdkc1dgaWrbgb+nz0bLG
drLXvlMFU7CTjr1//Dy9dXA5jVkfy0juS+qSO+ftHFc6GOluroYLOd3zF2hC2klv
uyKCcoUcI60uGp7nKK2N7lqytuGMYH9CbZ30VYWExwdzOy3I1IxqPxlFgpFyUAHA
NYb2/trT2JHqa2ZT/VKSKZ+PdOadNzWXNIJv5jS8HEceK18iRGi2lSySZu0iwf8b
IQjLLZb2vRkUcdHrgm0mHhF6ej3IA4Qp87N3LCkDqq4T7+x4TBMYfK1iKefpvuj1
PjvNOzz0p8ZNuam759+ElKrm+aoDLVJWIdUUdBzqvCZjIl8YSD8=
=expI
-----END PGP SIGNATURE-----