Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
For bugs related to Red Hat Enterprise Linux 4 product line. The current stable release is 4.9. For Red Hat Enterprise Linux 6 and above, please visit Red Hat JIRA https://issues.redhat.com/secure/CreateIssue!default.jspa?pid=12332745 to report new issues.

Bug 140335

Summary: Installing fonts packages in fast machine will not update the /usr/share/fonts/fonts.cache-1
Product: Red Hat Enterprise Linux 4 Reporter: Leon Ho <llch>
Component: fontconfigAssignee: Owen Taylor <otaylor>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 4.0CC: eng-i18n-bugs
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: fontconfig-2.2.3-7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-12-06 03:22:00 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 137149    
Attachments:
Description Flags
proposed patch
none
proposed patch none

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.