Bug 1982 - fc-cache and fast file modifications
Summary: fc-cache and fast file modifications
Status: RESOLVED FIXED
Alias: None
Product: fontconfig
Classification: Unclassified
Component: fc-cache (show other bugs)
Version: 2.2
Hardware: x86 (IA32) Linux (All)
: high normal
Assignee: Keith Packard
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-12-01 12:07 UTC by Owen Taylor
Modified: 2004-12-04 03:21 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Patch adding sleep() (946 bytes, patch)
2004-12-01 12:09 UTC, Owen Taylor
Details | Splinter Review

Description Owen Taylor 2004-12-01 12:07:32 UTC
If font modifications occur during the second after fc-cache writes
a cache file then the next call to fc-cache won't pick up the changes.

This is very likely to occur when installing a bunch of font packages
in a row.
  
 https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=140335

Very simple solution is to sleep a second before the end of fc-cache.
I'll attach a patch for that. Long term, it might be good to do 
something more complex, add locking and try to deal with parallel font 
installation as well.

(One possibility is to have a way to tell fc-cache that something
was known to change in a particular directory, and it would automatically
not trust that directory and the parent directory)
Comment 1 Owen Taylor 2004-12-01 12:09:55 UTC
Created attachment 1438 [details] [review]
Patch adding sleep()

The gettimeofday() checks in this patch are a little paranoid - 
my memory is that sleep() will be woken up by sigsuspend(), etc,
and I don't entirely trust sleep(1) not to sleep say, 0.9 seconds.

They'd need conditionalization with a configure.ac check since
they won't work on windows.
Comment 2 Keith Packard 2004-12-04 22:21:16 UTC
I'm just sleeping for two seconds; there's no need to be paranoid in this code;
it's not in the library, and we know there aren't any signals involved.  If
people are using SIGSTOP or SIGTSTP in installation scripts, they've got more
serious issues...


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.