[Fontconfig] [PATCH] Make the cache filenames determinstic

Keith Packard keithp at keithp.com
Tue Oct 30 03:50:56 UTC 2018


"Keith Packard" <keithp at keithp.com> writes:

> Chris Lamb <chris at chris-lamb.co.uk> 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/fontconfig/attachments/20181029/7a540d26/attachment.sig>


More information about the Fontconfig mailing list