Since version 2.22.1, the provided lilypond-<version>-fix-font-size.patch leads to a crash of lilypond when running it on any *.ly file. The patch changes a line in pango-font.cc However in version 2.22.1, there is the additional line `pango_font_description_free (descr);` in the source code, which causes a crash when combined with the provided patch file. Reproducible: Always Steps to Reproduce: 1. Compile lilypond with the provided lilypond-<version>-fix-font-size.patch file 2. Run lilypond on any file e.g. `lilypond test.ly` Actual Results: Lilypond crashes Expected Results: Lilypond should compile the file There are two solutions to the problem. 1. Remove the fix-font-size patch (I don't know what it is supposed to fix so i can't say if it's still needed) 2. Remove the `pango_font_description_free (descr);` line (see attached patch file)
Created attachment 765590 [details, diff] Revert free that leads to crash
Created attachment 765591 [details] Lighttpd DEBUG output on a small test file
All versions matching >=media-sound/lilypond-2.22.1 are broken you you Jan? Also I haven't looked into it much but won't "Revert free that leads to crash" lead to memory leaks? (dunno what "pango_font_description_free" does)
tl;dr Yes all versions matching >=media-sound/lilypond-2.22.1 are broken. The revert patch should not produce any memory leaks. Yes I checked all available versions (2.22.0, 2.22.1, 2.23.0, 2.23.2 and 9999). Only 2.22.0 did not crash. I did some research regarding memory leaks. The original code calls the function `pango_font_describe` The provided patch file replaces this with the function `pango_context_get_font_description`. `pango_font_describe` returns a newly-allocated PangoFontDescription object (see https://gnome.pages.gitlab.gnome.org/pango/Pango/method.Font.describe.html). `pango_context_get_font_description` returns a pointer to an existing font description. According to the docs, the value must not be freed (see https://docs.gtk.org/Pango/method.Context.get_font_description.html). So the call to `pango_font_description_free` is required in the original code to prevent memory leaks. But with the patch applied, not only is it not required, it is forbidden to free the value. If anyone wants to look into this, this is the line in question: https://github.com/lilypond/lilypond/blob/6380ca5973a34f4c44766c40dbef7c09f93fc004/lily/pango-font.cc#L425
> So the call to `pango_font_description_free` is required in the original code to prevent memory leaks. But with the patch applied, not only is it not required, it is forbidden to free the value. OH! Gotcha, thanks a lot Jan, I will try to merge this soon-ish.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fcaa927cebf1bc3db1404487e3fa7757a8e1eb99 commit fcaa927cebf1bc3db1404487e3fa7757a8e1eb99 Author: Maciej Barć <xgqt@gentoo.org> AuthorDate: 2022-02-24 01:18:06 +0000 Commit: Maciej Barć <xgqt@gentoo.org> CommitDate: 2022-02-24 01:23:49 +0000 media-sound/lilypond: add free temporary font description patch Closes: https://bugs.gentoo.org/833864 Package-Manager: Portage-3.0.30, Repoman-3.0.3 Signed-off-by: Maciej Barć <xgqt@gentoo.org> media-sound/lilypond/files/lilypond-2.22.1-free_font.patch | 14 ++++++++++++++ .../{lilypond-2.22.1.ebuild => lilypond-2.22.1-r1.ebuild} | 1 + .../{lilypond-2.23.0.ebuild => lilypond-2.23.0-r1.ebuild} | 1 + .../{lilypond-2.23.2.ebuild => lilypond-2.23.2-r1.ebuild} | 3 ++- media-sound/lilypond/lilypond-9999.ebuild | 1 + 5 files changed, 19 insertions(+), 1 deletion(-)