On Mon, Oct 29, 2018 at 8:49 PM Keith Packard <keithp@xxxxxxxxxx> wrote:
Chris Lamb <chris@xxxxxxxxxxxxxxxx> 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@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/fontconfig
--
behdad
http://behdad.org/
http://behdad.org/
_______________________________________________ Fontconfig mailing list Fontconfig@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/fontconfig