<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Mon, Oct 29, 2018 at 8:49 PM Keith Packard <<a href="mailto:keithp@keithp.com">keithp@keithp.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Chris Lamb <<a href="mailto:chris@chris-lamb.co.uk" target="_blank">chris@chris-lamb.co.uk</a>> writes:<br>
<br>
> Hi fontconfig@,<br>
><br>
> Whilst working on the Reproducible Builds[0] effort, we noticed that<br>
> fontconfig generates cache files with unreproducible/non-deterministic<br>
> filenames.<br>
<br>
I've dug into this a bit more and I think an architectural change in the<br>
cache files made last year is probably not what we want. That change has<br>
the name of the cache file stored in each font directory in a .uuid<br>
file. The patch you've proposed changes how the cache file name is<br>
generated, but leaves it stored in the .uuid file. I'm thinking we<br>
should revisit the whole .uuid file idea and go back to just using a<br>
hash of the directory path for the cache file name. That eliminates the<br>
.uuid file entirely, but does get us back to issues when font<br>
directories move or are accessed under different path names.<br>
<br>
To resolve (some of) those issues, I suggest that we adjust what path<br>
name is used when generating the hash identifying the directory. There<br>
are two important notions:<br>
<br>
 1) Multiple pathnames reaching the same directory. Symlinks and<br>
    relative paths could both happen here.<br>
<br>
 2) FONTCONFIG_SYSROOT and other mechanisms for setting the sysroot<br>
    value.<br></blockquote><div><br></div><div>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.<br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
For 1), using 'realpath(3)' to generate a canonical path name<br>
will make all paths to the same file end up with the same name.<br>
<br>
For 2), using realpath(3) on FONTCONFIG_SYSROOT and then eliding that<br>
from the start of the font path before computing the hash will mean that<br>
you can generate a font cache with sysroot set and the resulting cache<br>
will work on the target system.<br>
<br>
This eliminates the variance seen with reproducible builds and<br>
eliminates .uuid files cluttering up the disk and changing the contents<br>
of what should be read-only data.<br>
<br>
-- <br>
-keith<br>
_______________________________________________<br>
Fontconfig mailing list<br>
<a href="mailto:Fontconfig@lists.freedesktop.org" target="_blank">Fontconfig@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/fontconfig" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/fontconfig</a><br>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">behdad<br><a href="http://behdad.org/" target="_blank">http://behdad.org/</a></div></div>