From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 0DM4LfQ/zWCSNQEAgWs5BA (envelope-from ) for ; Sat, 19 Jun 2021 02:53:08 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id cInxKPQ/zWBKFQAA1q6Kng (envelope-from ) for ; Sat, 19 Jun 2021 00:53:08 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 1AA681996E for ; Sat, 19 Jun 2021 02:53:08 +0200 (CEST) Received: from localhost ([::1]:40518 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1luPEQ-0001Hf-T9 for larch@yhetil.org; Fri, 18 Jun 2021 20:53:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47074) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1luPEN-0001HW-0s for guix-patches@gnu.org; Fri, 18 Jun 2021 20:53:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:46818) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1luPEM-0006Ml-MQ for guix-patches@gnu.org; Fri, 18 Jun 2021 20:53:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1luPEM-0001pT-DT for guix-patches@gnu.org; Fri, 18 Jun 2021 20:53:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49107] [PATCH core-updates] gnu: fontconfig: Use (locally) deterministic caching Resent-From: Sarah Morgensen Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 19 Jun 2021 00:53:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 49107 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 49107@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.16240639466981 (code B ref -1); Sat, 19 Jun 2021 00:53:02 +0000 Received: (at submit) by debbugs.gnu.org; 19 Jun 2021 00:52:26 +0000 Received: from localhost ([127.0.0.1]:58364 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1luPDg-0001oS-Ia for submit@debbugs.gnu.org; Fri, 18 Jun 2021 20:52:26 -0400 Received: from lists.gnu.org ([209.51.188.17]:56192) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1luPDf-0001oL-2K for submit@debbugs.gnu.org; Fri, 18 Jun 2021 20:52:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47026) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1luPDe-0001E1-P1 for guix-patches@gnu.org; Fri, 18 Jun 2021 20:52:18 -0400 Received: from out1.migadu.com ([2001:41d0:2:863f::]:59794) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1luPDb-0005ov-0M for guix-patches@gnu.org; Fri, 18 Jun 2021 20:52:18 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mgsn.dev; s=key1; t=1624063929; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=2UECakbBe4mzsqpu4+Bh2chYXQwVBUjomBYA3s//rwU=; b=Ylt0XavSRij3+OGONRkFKZAg9OayLwwvIPFsmEp57gdjPt0SuSiUk3Og+R1S/uixs+y+80 cu9RV9WpXXMvDCSUr7j0HHhIPGQ1Oq45Z6xJc9489Zu+O/5Vb+R4MdHTkh+hSM0oyiHcPC vN26EfRgyltrKGj6q1weCbkTsAILeHQ= Date: Fri, 18 Jun 2021 17:52:05 -0700 Message-Id: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Migadu-Auth-User: iskarian@mgsn.dev Received-SPF: pass client-ip=2001:41d0:2:863f::; envelope-from=iskarian@mgsn.dev; helo=out1.migadu.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" Reply-to: Sarah Morgensen X-ACL-Warn: , Sarah Morgensen via Guix-patches From: Sarah Morgensen via Guix-patches via X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1624063988; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=2UECakbBe4mzsqpu4+Bh2chYXQwVBUjomBYA3s//rwU=; b=oLTcKb0YhutVVv1uYMAEpjbazG6AGi7rwRxcK7UKOki+N1ll0AKowlqdcfpLEUpp9gWARS e9njKHlV2C7GRGtfCEmfMCMrEVBP8PnTfFfkzQxE8b3+cP/gA/ELxLkdAOgQXU7nDijg3h O09cTI23EgspJl5ckpBBllVxYGF9LpkyubBmRZ9c9S4gPg8rM/C5XDroj4cPxIENqc+sYY SE7X6vYiW8r9q+utabIiwCMynpPxg8CFh+ipJ+RzK1y5A/n2vS0CDLnXa7QyaJvzLYvOXr /Ym/1jYV9qtbWNdq4RRrjWh7svtP8nth6eU8fOgssM5zr3hOboMJ6tLWsxeLjg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1624063988; a=rsa-sha256; cv=none; b=e4YxsfzfTF8lzdJNRkLc7q9GNc/2VEC6H9dxLKU2nd01qXIFb//kVExjQ+9qwmEVeiN2sp 1eTkrWqz4XHdSs3uXyuSH5JgMj+WpDst6K+Oh9LD/g8L71rkHRS1Xn3VHiS9FroqaL/Lbm 8BJfyopReIMCu2nznl7v4I/EJvA0nPAIY4C9sP8Vi4ZnThQSVp2JxOQHK6GBWNaK5Jyf5i 4vU6VJBc2JE6qCq4OHUf6pTiKumzAU4xwBBwgT3RJ+0g4FpodriOtXmQT8se1ZeebYtrVN 2wU9JkPl4edtwreeoJhyJioW7mcmYSOQ6DEE5wNa5mJf2235TlTU/yP9ySCYBg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=mgsn.dev header.s=key1 header.b=Ylt0XavS; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Spam-Score: -1.42 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=mgsn.dev header.s=key1 header.b=Ylt0XavS; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: 1AA681996E X-Spam-Score: -1.42 X-Migadu-Scanner: scn1.migadu.com X-TUID: gkeLI7ZAjrkK Make fontconfig use directory contents rather than modification time to determine cache validity (by pretending that mtime is broken). * gnu/packages/patches/fontconfig-cache-ignore-mtime.patch: New file. * gnu/local.mk (dist_patch_DATA): Register it. * gnu/packages/fontutils.scm (fontconfig)[source]: Use it. [arguments]: Unset SOURCE_DATE_EPOCH for tests. --- gnu/local.mk | 1 + gnu/packages/fontutils.scm | 7 ++++++- .../patches/fontconfig-cache-ignore-mtime.patch | 15 +++++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 gnu/packages/patches/fontconfig-cache-ignore-mtime.patch Hello Guix, This patch attempts to make fontconfig's caching work seamlessly on Guix, instead of requiring users to manually run `fc-cache -f` after installing or removing fonts. This addresses . Fontconfig usually uses a directory's mtime as its checksum. However, when fontconfig detects a "broken mtime" filesystem, it will generate a directory checksum from the directory listing contents. This is slightly slower, as it has to stat all the files in all font directories. Unconditionally enabling this mode should get us more regular behavior. I am not confident this method is fully deterministic; particular filesystem capabilities may still be an implicit imput in the checksums. This should only matter when distributing pre-generated caches. Fontconfig does honor SOURCE_DATE_EPOCH, but without a reliable mtime, fontconfig has no way of knowing when to update such a cache. SOURCE_DATE_EPOCH is now disabled for the tests because they assume working cache invalidation. I have tested this patch on x86-64. diff --git a/gnu/local.mk b/gnu/local.mk index c57e587e84..1d26c9e7c7 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1012,6 +1012,7 @@ dist_patch_DATA = \ %D%/packages/patches/fifo-map-remove-catch.hpp.patch \ %D%/packages/patches/findutils-localstatedir.patch \ %D%/packages/patches/flann-cmake-3.11.patch \ + %D%/packages/patches/fontconfig-cache-ignore-mtime.patch \ %D%/packages/patches/foobillard++-pkg-config.patch \ %D%/packages/patches/foomatic-filters-CVE-2015-8327.patch \ %D%/packages/patches/foomatic-filters-CVE-2015-8560.patch \ diff --git a/gnu/packages/fontutils.scm b/gnu/packages/fontutils.scm index dbce5beba8..0ee51a792e 100644 --- a/gnu/packages/fontutils.scm +++ b/gnu/packages/fontutils.scm @@ -14,6 +14,7 @@ ;;; Copyright © 2020 Nicolas Goaziou ;;; Copyright © 2021 Maxim Cournoyer ;;; Copyright © 2020, 2021 Nicolas Goaziou +;;; Copyright © 2021 Sarah Morgensen ;;; ;;; This file is part of GNU Guix. ;;; @@ -331,7 +332,8 @@ Font Format (WOFF).") "https://www.freedesktop.org/software/" "fontconfig/release/fontconfig-" version ".tar.xz")) (sha256 (base32 - "1850q4k80yxma5g3yxkvyv8i5a3xqzswwml8gjy3jmywx8qqd5pa")))) + "1850q4k80yxma5g3yxkvyv8i5a3xqzswwml8gjy3jmywx8qqd5pa")) + (patches (search-patches "fontconfig-cache-ignore-mtime.patch")))) (build-system gnu-build-system) ;; In Requires or Requires.private of fontconfig.pc. (propagated-inputs `(("expat" ,expat) @@ -362,6 +364,9 @@ Font Format (WOFF).") (modify-phases %standard-phases (add-before 'check 'skip-problematic-tests (lambda _ + ;; SOURCE_DATE_EPOCH doesn't make sense when ignoring mtime + (unsetenv "SOURCE_DATE_EPOCH") + (substitute* "test/run-test.sh" ;; The crbug1004254 test attempts to fetch fonts from the ;; network. diff --git a/gnu/packages/patches/fontconfig-cache-ignore-mtime.patch b/gnu/packages/patches/fontconfig-cache-ignore-mtime.patch new file mode 100644 index 0000000000..b6e942ee10 --- /dev/null +++ b/gnu/packages/patches/fontconfig-cache-ignore-mtime.patch @@ -0,0 +1,15 @@ +Pretend that stat's mtime is broken, so that the fontconfig cache does not +depend upon modification time to determine if a cache is stale. + +diff --git a/src/fcstat.c b/src/fcstat.c +index 5a2bd7c..d603a96 100644 +--- a/src/fcstat.c ++++ b/src/fcstat.c +@@ -431,6 +431,7 @@ FcIsFsMmapSafe (int fd) + FcBool + FcIsFsMtimeBroken (const FcChar8 *dir) + { ++ return FcTrue; + int fd = FcOpen ((const char *) dir, O_RDONLY); + + if (fd != -1) base-commit: bcdc13454c4afab37b650d4bbfa95e539060619f -- 2.31.1