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.
This commit is contained in:
Sayamindu Dasgupta 2008-05-24 16:15:27 -07:00 committed by Keith Packard
parent b808204023
commit ad3fc66791
1 changed files with 12 additions and 1 deletions

View File

@ -156,6 +156,17 @@ FcConfigUptoDate (FcConfig *config)
(config_dir_time.set && (config_dir_time.time - config->rescanTime) > 0) ||
(font_time.set && (font_time.time - config->rescanTime) > 0))
{
/* 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;