From patchwork Sat Jun 19 00:52:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sarah Morgensen X-Patchwork-Id: 30457 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id BAEFF27BC78; Sat, 19 Jun 2021 01:53:10 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,SPF_HELO_PASS,T_DKIM_INVALID,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id C91EC27BC81 for ; Sat, 19 Jun 2021 01:53:09 +0100 (BST) Received: from localhost ([::1]:40518 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1luPES-0001Hf-Rh for patchwork@mira.cbaines.net; Fri, 18 Jun 2021 20:53:08 -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 X-Migadu-Flow: FLOW_OUT 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+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" Reply-to: Sarah Morgensen X-ACL-Warn: , Sarah Morgensen via Guix-patches X-Patchwork-Original-From: Sarah Morgensen via Guix-patches via From: Sarah Morgensen X-getmail-retrieved-from-mailbox: Patches 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. base-commit: bcdc13454c4afab37b650d4bbfa95e539060619f 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)