Stop cleaning up .uuid file even when a directory is empty.

This commit is contained in:
Akira TAGOH 2018-11-07 06:06:51 +00:00
parent f106891fe9
commit 04871bfde5
2 changed files with 98 additions and 1 deletions

View File

@ -0,0 +1,93 @@
From 5f12f564f8748deaa603adb7a4b8f616b6390ad4 Mon Sep 17 00:00:00 2001
From: Keith Packard <keithp@keithp.com>
Date: Wed, 17 Oct 2018 21:15:47 -0700
Subject: [PATCH 1/2] Do not remove UUID file when a scanned directory is empty
Because FcDirCacheDeleteUUID does not reset the modification time on
the directory, and because FcDirCacheRead unconditionally creates the
UUID file each time it is run, any empty directory in the cache will
get its timestamp changed each time the cache for that directory is
read.
Instead, just leave the UUID file around as it is harmless.
The alternative would be to only create the UUID file after the cache
has been created and the directory has been discovered to be
non-empty, but that would delay the creation of the UUID file.
Signed-off-by: Keith Packard <keithp@keithp.com>
---
src/fcdir.c | 7 -------
1 file changed, 7 deletions(-)
diff --git a/src/fcdir.c b/src/fcdir.c
index 93f220c..bfcdf95 100644
--- a/src/fcdir.c
+++ b/src/fcdir.c
@@ -421,13 +421,6 @@ FcDirCacheRead (const FcChar8 *dir, FcBool force, FcConfig *config)
/* Not using existing cache file, construct new cache */
if (!cache)
cache = FcDirCacheScan (dir, config);
- if (cache)
- {
- FcFontSet *fs = FcCacheSet (cache);
-
- if (cache->dirs_count == 0 && (!fs || fs->nfont == 0))
- FcDirCacheDeleteUUID (dir, config);
- }
return cache;
}
--
2.19.1
From e9113a764a1001165711022aceb45aa2765feb8b Mon Sep 17 00:00:00 2001
From: Akira TAGOH <akira@tagoh.org>
Date: Thu, 25 Oct 2018 07:16:32 +0000
Subject: [PATCH 2/2] Do not run a test case for .uuid deletion
---
test/run-test.sh | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/test/run-test.sh b/test/run-test.sh
index e76e39b..ed41456 100644
--- a/test/run-test.sh
+++ b/test/run-test.sh
@@ -239,19 +239,19 @@ fi
rm -rf $MyPWD/sysroot
-dotest "deleting .uuid file on empty dir"
-prep
-cp $FONT1 $FONT2 $FONTDIR
-$FCCACHE $FONTDIR
-sleep 1
-rm -f $FONTDIR/*pcf
-$FCCACHE $FONTDIR
-rmdir $FONTDIR > /dev/null 2>&1
-if [ $? != 0 ]; then
- echo "*** Test failed: $TEST"
- echo "$FONTDIR isn't empty"
- ls -al $FONTDIR
- exit 1
-fi
+# dotest "deleting .uuid file on empty dir"
+# prep
+# cp $FONT1 $FONT2 $FONTDIR
+# $FCCACHE $FONTDIR
+# sleep 1
+# rm -f $FONTDIR/*pcf
+# $FCCACHE $FONTDIR
+# rmdir $FONTDIR > /dev/null 2>&1
+# if [ $? != 0 ]; then
+# echo "*** Test failed: $TEST"
+# echo "$FONTDIR isn't empty"
+# ls -al $FONTDIR
+# exit 1
+# fi
rm -rf $FONTDIR $CACHEFILE $CACHEDIR $FONTCONFIG_FILE out
--
2.19.1

View File

@ -5,7 +5,7 @@
Summary: Font configuration and customization library
Name: fontconfig
Version: 2.13.1
Release: 1%{?dist}
Release: 3%{?dist}
# src/ftglue.[ch] is in Public Domain
# src/fccache.c contains Public Domain code
# fc-case/CaseFolding.txt is in the UCD
@ -19,6 +19,7 @@ Source2: fc-cache
# https://bugzilla.redhat.com/show_bug.cgi?id=140335
Patch0: %{name}-sleep-less.patch
Patch1: %{name}-required-freetype-version.patch
Patch2: %{name}-stop-cleanup-uuid.patch
BuildRequires: expat-devel
BuildRequires: freetype-devel >= %{freetype_version}
@ -167,6 +168,9 @@ HOME=/root /usr/bin/fc-cache -s
%doc fontconfig-devel.txt fontconfig-devel
%changelog
* Wed Nov 07 2018 Akira TAGOH <tagoh@redhat.com> - 2.13.1-3
- Stop cleaning up .uuid file even when a directory is empty.
* Wed Sep 26 2018 Akira TAGOH <tagoh@redhat.com> - 2.13.1-2
- Add man page for fc-cache-* links to fc-cache.
- Drop unnecessary BR.