Re: Next steps for a reproducible Fontconfig?

"Keith Packard" <[email protected]> Thu, 10 Jan 2019 11:36:38 -0800
Newsgroups gmane.comp.fonts.fontconfig
Message-ID <[email protected]>
Akira TAGOH <[email protected]> writes:

> Indeed, that would be able to accomplish both with the minimal efforts
> for us at least. though they might came up with this but they didn't
> do it that way. so there might be some reason why they didn't do so.
> packaging issue perhaps?

flatpak appears to change many pathnames used to access host files. I
don't know if there are other subsystems affected by these changes,
perhaps we'll see more in the future though.

> I can't figure out completely but, fontconfig may needs to deal with
> different namespaces in a cache filename to avoid a collision between
> host and sandboxes. dunno if we may see different state in the future
> but it might be represented as a depth in a filename to make it
> different like 0:<md5>-le64.cache-<version> for host and
> 1:<md5>-le64.cache-<version> for a sandbox.
>
> we could increase a depth
> for a child in sandbox as needed, anyway.
> We can mix up caches that is located at the same place then. the last
> missing piece would be to map them to the right place. flatpaks should
> knows where they mounted directories to. they can create a map table
> with proper parent depth and current depth I think.

That would require customizing the contents of a flatpak on install, or
perhaps this could be done when the flatpak was run?

> I may be missing something so this might not work though...

This seems to extend the change I proposed; which provides an
indirection between the actual filename and the font config cache
database key. Instead of just mapping sandbox names to external names
(which results in collisions), we also add some 'salt' to the sandbox
names to perturb the generated key for internal paths.

Let's look at some examples:

        sandbox prefix          cache prefix
        --------------          ----------
        /run/host/fonts         /usr/share/fonts
        /run/host/user-fonts    /home/keithp/.fonts
        /                       sandbox-depth-1/

'sandbox-depth-1' is the "salt" added to the cache keys for paths within
the sandbox to ensure they do not collide with cache keys for paths
outside of the sandbox.

You'd add all mounted file systems to this list so that fonts found
anywhere outside the sandbox would generate cache keys using the names
from outside the sandbox. If you ran another sandbox *inside* this
sandbox, you'd have another level of indirection:

        /run/host/fonts         sandbox-depth-1/usr/share/fonts
        /                       sandbox-depth-1/

(assuming that the sandbox didn't manage to mount the "real" system
fonts inside the sandbox somewhere).

This configuration file would be generated by flatpak at runtime.

-- 
-keith

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

iQIzBAEBCAAdFiEEw4O3eCVWE9/bQJ2R2yIaaQAAABEFAlw3nsYACgkQ2yIaaQAA
ABHMow/9FHa85nyECyeJlPZYN00VBQD5l0b0LD6oQtJkz0vyok4IWDTy9SuNLpDq
svK1LKe0mLmYAZy9gLCcwTovugMtcLzX93zJ5rdZgDLIwt7Wla2oB1UvrzTi23Q2
sUutIQZ/dMKYR/8WFML0xggVBJ4eDltWlIP8uqRYpbCJuNYu8gzXQahv5IxadEzo
4Vziz9CnsbocCVpUs9j0T5jTznWmhYvxRhQrlVha87iIJMxUHM8D845NXGy77Re+
h+FEM69fHkMulVyE23nQ6+O6IqMeZZfmebJ2TjZZYPVWYAJIeoylHJBMBrXLy6qK
36kjlNUQov7n5vN2Z+14qh0dTtp7o/G4BOqVZr7VhuBPAfxbVuQsAbyby0W88mDv
bZAp8A9+4t8SO6s7iiIoH1bSL7LnLi1uLdATknps2JdgFGHEiTOox1LrFs7kDyHV
P6LBvR10PKDiUU40fEnjVh2bzUvye1/9kZQovTJ6UBMm7SFx5wxfc+1TzRKZIXQo
K6Qjar9OU0O6PWz4/NTa3gaX8cZz6dJsJlJgHv1NRP3lDs5yY8Wnrjw3gFGWqLgt
6T7s3KHLdZTfCJKGgjwABxVQziUXli7oxZvYQKxyelTNOgIxLe8qIB9Mts4eowFu
mlGEXOsRdeOSukCcYEdhpTH8521et9WracPyQvD2B7Z27DzZ0HU=
=rgnl
-----END PGP SIGNATURE-----