[Fontconfig] [PATCH] Make the cache filenames determinstic

Behdad Esfahbod behdad at behdad.org
Tue Oct 30 05:39:23 UTC 2018


On Mon, Oct 29, 2018 at 8:49 PM Keith Packard <keithp at keithp.com> wrote:

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

I don't like the new mechanism either, but I think it was added to resolve
bind-mounted font dirs, which are not covered by your two cases above.
IIUC any flatpak app binds the fonts dir in a new unique directory.  Would
be desirable to reuse the system caches.



> 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
> Fontconfig at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/fontconfig
>


-- 
behdad
http://behdad.org/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/fontconfig/attachments/20181029/a7f5eab2/attachment.html>


More information about the Fontconfig mailing list