[bug#76922] gnu: cairo: Add patch to fix regression when writing PDFs with fonts
Commit Message
Applied patch fixes out of memory errors when writing PDFs with fonts
in xournalpp and others. See also:
https://gitlab.freedesktop.org/cairo/cairo/-/issues/870
* gnu/local.mk: Register patch.
* gnu/packages/gtk.scm (cairo): Add patch.
* gnu/packages/patches/cairo-cff-dont-fail-if-no-local-subs: Add patch.
Change-Id: Id6475d0ddb27208486bf41e18de72d116da110fb
---
gnu/local.mk | 3 +-
gnu/packages/gtk.scm | 2 ++
...cairo-cff-dont-fail-if-no-local-subs.patch | 34 +++++++++++++++++++
3 files changed, 38 insertions(+), 1 deletion(-)
create mode 100644 gnu/packages/patches/cairo-cff-dont-fail-if-no-local-subs.patch
base-commit: d0510dcd824e1b3fda62a8841e792581d7b8de8d
Comments
Am Montag, dem 10.03.2025 um 17:15 +0100 schrieb Remco van 't Veer:
> Applied patch fixes out of memory errors when writing PDFs with fonts
> in xournalpp and others. See also:
>
> https://gitlab.freedesktop.org/cairo/cairo/-/issues/870
>
> * gnu/local.mk: Register patch.
> * gnu/packages/gtk.scm (cairo): Add patch.
> * gnu/packages/patches/cairo-cff-dont-fail-if-no-local-subs: Add
> patch.
>
> Change-Id: Id6475d0ddb27208486bf41e18de72d116da110fb
> ---
Out of curiosity, how many packages do you need to rebuild with this
patch? It could well be that you'd need to use a graft.
Cheers
Hi,
2025/03/10, Liliana Marie Prikler:
> Am Montag, dem 10.03.2025 um 17:15 +0100 schrieb Remco van 't Veer:
>> Applied patch fixes out of memory errors when writing PDFs with fonts
>> in xournalpp and others. See also:
>>
>> https://gitlab.freedesktop.org/cairo/cairo/-/issues/870
>>
>> * gnu/local.mk: Register patch.
>> * gnu/packages/gtk.scm (cairo): Add patch.
>> * gnu/packages/patches/cairo-cff-dont-fail-if-no-local-subs: Add
>> patch.
>>
>> Change-Id: Id6475d0ddb27208486bf41e18de72d116da110fb
>> ---
> Out of curiosity, how many packages do you need to rebuild with this
> patch? It could well be that you'd need to use a graft.
Yes you a probably right because I sent this patch after Ludo shooed me
away when I made a PR on codeberg
(https://codeberg.org/civodul/guix/pulls/17#issuecomment-2995653).
$ ./pre-inst-env guix refresh -l -e '(@@ (gnu packages gtk) cairo)' | wc -w
4279
Would you like me to make a v2 and use a graft?
Cheers,
Remco
Am Montag, dem 10.03.2025 um 21:07 +0100 schrieb Remco van 't Veer:
> $ ./pre-inst-env guix refresh -l -e '(@@ (gnu packages gtk) cairo)'
> | wc -w
> 4279
>
> Would you like me to make a v2 and use a graft?
Yes, please do. We can ungraft it later on core-packages-team, gnome-
team, or a dedicated ungrafting branch.
Cheers
Hi,
Liliana Marie Prikler <liliana.prikler@gmail.com> writes:
> Am Montag, dem 10.03.2025 um 17:15 +0100 schrieb Remco van 't Veer:
>> Applied patch fixes out of memory errors when writing PDFs with fonts
>> in xournalpp and others. See also:
>>
>> https://gitlab.freedesktop.org/cairo/cairo/-/issues/870
>>
>> * gnu/local.mk: Register patch.
>> * gnu/packages/gtk.scm (cairo): Add patch.
>> * gnu/packages/patches/cairo-cff-dont-fail-if-no-local-subs: Add
>> patch.
>>
>> Change-Id: Id6475d0ddb27208486bf41e18de72d116da110fb
>> ---
> Out of curiosity, how many packages do you need to rebuild with this
> patch? It could well be that you'd need to use a graft.
Too many (15k). I've hit that problem too. I'd suggest grafting to
1.18.4 directly instead of carrying patches.
@@ -48,7 +48,7 @@
# Copyright © 2021 Andrew Tropin <andrew@trop.in>
# Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com>
# Copyright © 2022 Daniel Meißner <daniel.meissner-i4k@ruhr-uni-bochum.de>
-# Copyright © 2022, 2024 Remco van 't Veer <remco@remworks.net>
+# Copyright © 2022, 2024, 2025 Remco van 't Veer <remco@remworks.net>
# Copyright © 2022, 2024 Artyom V. Poptsov <poptsov.artyom@gmail.com>
# Copyright © 2022, 2023 John Kehayias <john.kehayias@protonmail.com>
# Copyright © 2022 muradm <mail@muradm.net>
@@ -1069,6 +1069,7 @@ dist_patch_DATA = \
%D%/packages/patches/busybox-add-missing-sha-NI-guard.patch \
%D%/packages/patches/c2rust-ast-exporter-local-search.patch \
%D%/packages/patches/cadical-add-shared-library.patch \
+ %D%/packages/patches/cairo-cff-dont-fail-if-no-local-subs.patch \
%D%/packages/patches/calibre-no-updates-dialog.patch \
%D%/packages/patches/calibre-remove-test-sqlite.patch \
%D%/packages/patches/calibre-remove-test-unrar.patch \
@@ -38,6 +38,7 @@
;;; Copyright © 2023 Janneke Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2024 John Kehayias <john.kehayias@protonmail.com>
;;; Copyright © 2025 Florian Pelz <pelzflorian@pelzflorian.de>
+;;; Copyright © 2025 Remco van 't Veer <remco@remworks.net>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -178,6 +179,7 @@ (define cairo
(uri
(string-append "https://cairographics.org/releases/cairo-"
version ".tar.xz"))
+ (patches (search-patches "cairo-cff-dont-fail-if-no-local-subs.patch"))
(sha256
(base32 "0nnli5cghygbl9bvlbjls7nspnrrzx1y1pbd7p649s154js9nax6"))))
(build-system meson-build-system)
new file mode 100644
@@ -0,0 +1,34 @@
+From f19e2fe080ddcfce93c8234a919fd882f3d63362 Mon Sep 17 00:00:00 2001
+From: Adrian Johnson <ajohnson@redneon.com>
+Date: Fri, 13 Sep 2024 06:28:39 +0930
+Subject: [PATCH] cff: Don't fail if no local subs
+
+Fixes: #870
+---
+ src/cairo-cff-subset.c | 10 +++++++---
+ 1 file changed, 7 insertions(+), 3 deletions(-)
+
+diff --git a/src/cairo-cff-subset.c b/src/cairo-cff-subset.c
+index 076cb2b0a..8a7de0065 100644
+--- a/src/cairo-cff-subset.c
++++ b/src/cairo-cff-subset.c
+@@ -952,9 +952,13 @@ cairo_cff_font_read_private_dict (cairo_cff_font_t *font,
+ decode_number (operand, nominal_width);
+
+ num_subs = _cairo_array_num_elements (local_sub_index);
+- *local_subs_used = _cairo_calloc_ab (num_subs, sizeof (cairo_bool_t));
+- if (unlikely (*local_subs_used == NULL))
+- return _cairo_error (CAIRO_STATUS_NO_MEMORY);
++ if (num_subs > 0) {
++ *local_subs_used = _cairo_calloc_ab (num_subs, sizeof (cairo_bool_t));
++ if (unlikely (*local_subs_used == NULL))
++ return _cairo_error (CAIRO_STATUS_NO_MEMORY);
++ } else {
++ *local_subs_used = NULL;
++ }
+
+ if (num_subs < 1240)
+ *local_sub_bias = 107;
+--
+GitLab
+