]> git.wh0rd.org - fontconfig.git/commitdiff
FcConfigUptoDate breaks if directory mtime is in the future. Bug 14424.
authorSayamindu Dasgupta <sayamindu@gmail.com>
Sat, 24 May 2008 23:15:27 +0000 (16:15 -0700)
committerKeith Packard <keithp@keithp.com>
Sat, 24 May 2008 23:15:27 +0000 (16:15 -0700)
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.

src/fccfg.c

index 853eb7f37a738f7e312b378253194dc1270d2732..acb0bb4aabacfba58bdbfc9321a8ca8e1ce5e270 100644 (file)
@@ -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;