backport Report more detailed logs by default instead of assertion

Signed-off-by: htpeng <htpengc@isoftstone.com>
(cherry picked from commit 9e967fa7c9cb956f7c645eb3630fe14834e6ec51)
This commit is contained in:
htpeng 2023-08-31 11:13:15 +08:00 committed by openeuler-sync-bot
parent cbec482778
commit 4e014f14b8
2 changed files with 84 additions and 1 deletions

View File

@ -0,0 +1,79 @@
From ea2fe8840d084adebbbd93de162ae76f5fc5ef45 Mon Sep 17 00:00:00 2001
From: htpeng <htpengc@isoftstone.com>
Date: Thu, 31 Aug 2023 09:45:49 +0800
Subject: [PATCH] Report more detailed logs instead of assertion
Reference: https://gitlab.freedesktop.org/fontconfig/fontconfig/-/merge_requests/257
Signed-off-by: htpeng <htpengc@isoftstone.com>
---
src/fccache.c | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/src/fccache.c b/src/fccache.c
index b2392d3..b39cb0a 100644
--- a/src/fccache.c
+++ b/src/fccache.c
@@ -287,7 +287,7 @@ FcDirCacheUnlink (const FcChar8 *dir, FcConfig *config)
ret = FcFalse;
goto bail;
}
-
+
while ((cache_dir = FcStrListNext (list)))
{
if (sysroot)
@@ -381,7 +381,7 @@ FcDirCacheProcess (FcConfig *config, const FcChar8 *dir,
list = FcStrListCreate (config->cacheDirs);
if (!list)
return FcFalse;
-
+
while ((cache_dir = FcStrListNext (list)))
{
FcChar8 *cache_hashed;
@@ -793,20 +793,17 @@ FcCacheFini (void)
{
int i;
- for (i = 0; i < FC_CACHE_MAX_LEVEL; i++)
+ if (FcDebug() & FC_DBG_CACHE)
{
- if (FcDebug() & FC_DBG_CACHE)
+ for (i = 0; i < FC_CACHE_MAX_LEVEL; i++)
{
if (fcCacheChains[i] != NULL)
{
FcCacheSkip *s = fcCacheChains[i];
- printf("Fontconfig error: not freed %p (dir: %s, refcount %" FC_ATOMIC_INT_FORMAT ")\n", s->cache, FcCacheDir(s->cache), s->ref.count);
+ fprintf(stderr, "Fontconfig error: not freed %p (dir: %s, refcount %" FC_ATOMIC_INT_FORMAT ")\n", s->cache, FcCacheDir(s->cache), s->ref.count);
}
}
- else
- assert (fcCacheChains[i] == NULL);
}
- assert (fcCacheMaxLevel == 0);
free_lock ();
}
@@ -1018,7 +1015,7 @@ FcDirCacheMapFd (FcConfig *config, int fd, struct stat *fd_stat, struct stat *di
/* Mark allocated caches so they're freed rather than unmapped */
if (allocated)
cache->magic = FC_CACHE_MAGIC_ALLOC;
-
+
return cache;
}
@@ -1708,7 +1705,7 @@ FcCacheCopySet args1(const FcCache *c)
for (i = 0; i < old->nfont; i++)
{
FcPattern *font = FcFontSetFont (old, i);
-
+
FcPatternReference (font);
if (!FcFontSetAdd (new, font))
{
--
2.34.1

View File

@ -2,7 +2,7 @@
Name: fontconfig
Version: 2.13.94
Release: 2
Release: 3
Summary: Fontconfig is a library for configuring and customizing font access
License: MIT and Public Domain and UCD
URL: http://fontconfig.org
@ -11,6 +11,7 @@ Source1: fc-cache
Source2: FcConfigGetFilename.3
Patch6000: backport-fontconfig-disable-network-required-test.patch
Patch6001: backport-Report-more-detailed-logs-instead-of-assertion.patch
BuildRequires: libxml2-devel freetype-devel >= %{freetype_version} fontpackages-devel libuuid-devel
BuildRequires: autoconf automake libtool gettext itstool gperf
@ -121,6 +122,9 @@ HOME=/root /usr/bin/fc-cache -s
%{_mandir}/man3/*
%changelog
* Thu Aug 31 2023 penghaitao <htpengc@isoftstone.com> - 2.13.94-3
- Report more detailed logs by default instead of assertion
* Fri Oct 21 2022 zhouwenpei <zhouwenpei1@h-partners.com> - 2.13.94-2
- delete sensitive words in changelog