Bug 140335 - Installing fonts packages in fast machine will not update the /usr/share/fonts/fonts.cache-1
Summary: Installing fonts packages in fast machine will not update the /usr/share/font...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: fontconfig
Version: 4.0
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
: ---
Assignee: Owen Taylor
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: 137149
TreeView+ depends on / blocked
 
Reported: 2004-11-22 13:40 UTC by Leon Ho
Modified: 2007-11-30 22:07 UTC (History)
1 user (show)

Fixed In Version: fontconfig-2.2.3-7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2004-12-06 03:22:00 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
proposed patch (1.07 KB, patch)
2004-11-22 18:16 UTC, Akira TAGOH
no flags Details | Diff
proposed patch (1.06 KB, patch)
2004-11-22 18:20 UTC, Akira TAGOH
no flags Details | Diff

Description Leon Ho 2004-11-22 13:40:01 UTC
Description of problem:
When installing fonts packages in fast machine, even though the %post
has fc-cache /usr/share/fonts, it will not update the
/usr/share/fonts/fonts.cache-1 properly with new directories and files.

How reproducible:
everytime

Steps to Reproduce:
1. Get ttfonts-indic-1.7-2
2. rpm -e ttfonts-bn ttfonts-gu ttfonts-hi ttfonts-ta ttfonts-pa
3. rpm -Uvh ttfonts-*-1.7-2*.rpm
4. cat /usr/share/fonts/fonts.cache-1
  
Actual results:
Not all new directories is in /usr/share/fonts/fonts.cache-1

Expected results:
All new directories is in /usr/share/fonts/fonts.cache-1

Additional info:

Comment 1 Akira TAGOH 2004-11-22 14:25:48 UTC
I consider some solution for this:
1. on fontconfig side, though this may be not the best solution,
comparing the actual total numbers of directories and nsubdirs() would
improves to recognize the changes.

2. if you think it's not a bug, ttfonts-* package maintainer could
just do touch -t `date -d '1 second ago' +%Y%m%d%H%M.%S`
/usr/share/fonts/fonts.cache-1 and touch -t `date +%Y%m%d%H%M.%S`
/usr/share/fonts to avoid this. but I doubt it's the right fix.


Comment 2 Owen Taylor 2004-11-22 16:27:33 UTC
Not an immediate solution, but one possibility would be to 
add an option to fc-cache that is like '-f' but only for
the toplevel.

So,

 fc-cache --force-one-level /usr/share/fonts

would force scanning of /usr/share/fonts, but trust modtime
for subdirectories.


Comment 3 Akira TAGOH 2004-11-22 18:16:42 UTC
Created attachment 107211 [details]
proposed patch

Owen, how about this patch? this problem is caused by not updating the parent
fonts.cache-1 at least. even if the modification time is the same between the
directory and the file, fc-cache with this patch can detects the new sub
directory and assumes that fonts.cache-1 is invalid.

Comment 4 Akira TAGOH 2004-11-22 18:20:13 UTC
Created attachment 107212 [details]
proposed patch

Oops, this is correct one.

Comment 5 Leon Ho 2004-11-23 06:17:38 UTC
Owen, what is your suggestion here? We might randomly hit this bug
depends on how fast do users install.

Should we patch fontconfig, or to modify all of the ttfonts-* packages?

Comment 6 Owen Taylor 2004-11-24 21:38:40 UTC
The problem with the patch above is that it only handles the
problem for a single level, which works for this particular
case, because we have direct subdirs of but leaves many similar
problems elsewhere.

What I discussed with Keith was making fc-cache call FcDirScan
with a special mode where it would ignore timestamps for directories
and trust them only for files.

You wouldn't want to do that for all uses of FcDirScan (too
expensive to do a full tree walk of the filesystem every time
an app starts), but doing it for fc-cache is likely OK.


Comment 7 Akira TAGOH 2004-11-25 06:59:49 UTC
Ok, I see. so %post on each ttfonts-* packages needs to be changed
after that, right?

Comment 8 Owen Taylor 2004-11-25 14:51:06 UTC
I think the mode can be the default for 'fc-cache'; I don't
think that will be too slow. So no changes to the %post will
be necessary.

Comment 9 Owen Taylor 2004-12-01 20:30:43 UTC
Turned out to be harder to do that fix then I thought.

What I ended up doing was a very simple suggestion from
Keith Packard ... put a sleep(1) right before the termination
of fc-cache. This will make the install 15 or seconds slower,
which is definitely unfortunate, but is a very low risk
change, which is good at this point.

fontconfig-2.2.3-6 has that fix (tested with some artificial
cases.) Further tesing appreciated.


Comment 10 Leon Ho 2004-12-03 04:16:01 UTC
It works quite okay, and the speed is not bad when install those 5
packages. Now installing between packages there are slight delay (no
HDD activities). 

Waiting for i18n QA to verify this as well before closing.

Comment 11 Lawrence Lim 2004-12-06 03:22:00 UTC
Confirm fixed. Tested with fontconfig-2.2.3-7 and ttfonts-indic-1.8.1
on an average machine and a fast machine, the entries are now updated
properly.

Thanks.


Note You need to log in before you can comment on or make changes to this bug.