[Fontconfig] fontconfig: Branch 'master'

Keith Packard keithp at kemper.freedesktop.org
Sat May 24 16:15:32 PDT 2008


 src/fccfg.c |   13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

New commits:
commit ad3fc667914d19435ade56adc8afe584d5605d10
Author: Sayamindu Dasgupta <sayamindu at gmail.com>
Date:   Sat May 24 16:15:27 2008 -0700

    FcConfigUptoDate breaks if directory mtime is in the future. Bug 14424.
    
    At OLPC, we came across a bug where the Browse activity (based on xulrunner)
    took 100% CPU after an upgrade/. It turns out the Mozilla uses
    FcConfigUptoDate() to check if new fonts have been added to the system, and
    this function was always returning FcFalse since we have the mtimes of some
    font directories set in the future. The attached patch makes
    FcConfigUptoDate() print a warning and return FcTrue if mtime of directories
    are in the future.

diff --git a/src/fccfg.c b/src/fccfg.c
index 853eb7f..acb0bb4 100644
--- a/src/fccfg.c
+++ b/src/fccfg.c
@@ -156,7 +156,18 @@ FcConfigUptoDate (FcConfig *config)
 	(config_dir_time.set && (config_dir_time.time - config->rescanTime) > 0) ||
 	(font_time.set && (font_time.time - config->rescanTime) > 0))
     {
-	return FcFalse;
+	/* We need to check for potential clock problems here (OLPC ticket #6046) */
+	if ((config_time.set && (config_time.time - now) > 0) ||
+    	(config_dir_time.set && (config_dir_time.time - now) > 0) ||
+        (font_time.set && (font_time.time - now) > 0))
+	{
+	    fprintf (stderr,
+                    "Fontconfig warning: Directory/file mtime in the future. New fonts may not be detected\n");
+	    config->rescanTime = now;
+	    return FcTrue;
+	}
+	else
+	    return FcFalse;
     }
     config->rescanTime = now;
     return FcTrue;


More information about the Fontconfig mailing list