The fontconfig caches update_font_cache builds into an image are never
used on the target. fontconfig accepts a cache only while the directory
mtime it recorded matches the directory, and three things disagree about
that mtime:
- fc-cache records min(directory mtime, SOURCE_DATE_EPOCH). When the
intercept runs, the font directories still carry their packages'
mtimes and SOURCE_DATE_EPOCH is the image's fallback value.
- reproducible_final_image_task then sets every mtime in the rootfs to
REPRODUCIBLE_TIMESTAMP_ROOTFS.
- mke2fs clamps every inode time to the SOURCE_DATE_EPOCH in its
environment, so an ext image ends up with a different time again from
a tar or squashfs image of the same rootfs.
So every process using fonts rescans and writes a cache of its own, or
fails to on a read-only rootfs. fc-cache also deletes a cache it has
just written for a directory newer than SOURCE_DATE_EPOCH, so with the
default values some caches are missing from the image entirely.
Patches 1-2 run fc-cache under REPRODUCIBLE_TIMESTAMP_ROOTFS, with the
font directories' mtimes already set to it. Patch 3 keeps that time in ext
images, as oe_mksquashfs already does for squashfs. That moves every
inode and superblock time in an ext image from
SOURCE_DATE_EPOCH_FALLBACK to REPRODUCIBLE_TIMESTAMP_ROOTFS, which with
the bitbake.conf defaults is from 2011-04-05 to 2018-03-09. Patch 4
adds a selftest that boots an image carrying a font and checks that
fontconfig accepts every cache and writes none. On qemuarm64 it fails
without patches 1-3 and passes with them.
---
Alex Kiernan (4):
package_manager: pass REPRODUCIBLE_TIMESTAMP_ROOTFS to intercepts
update_font_cache: write caches that are valid in the final image
image_types: keep the rootfs mtimes in ext2/3/4 images
oeqa/selftest: check the font caches an image ships are used
meta/classes-recipe/fontcache.bbclass | 1 +
meta/classes-recipe/image_types.bbclass | 6 ++++
meta/lib/oe/package_manager/__init__.py | 6 ++++
meta/lib/oeqa/selftest/cases/fontcache.py | 42 +++++++++++++++++++++++++++
scripts/postinst-intercepts/update_font_cache | 12 +++++++-
5 files changed, 66 insertions(+), 1 deletion(-)
---
base-commit: 6b2dcfdbe16055edc88f72dabf07e33f8163d8eb
change-id: 20261013-fontcache-reproducible-mtime-f03aa3135def
Best regards,
--
Alex Kiernan <[email protected]>
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#247716):
https://lists.openembedded.org/g/openembedded-core/message/247716
Mute This Topic: https://lists.openembedded.org/mt/121730203/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-