Bug 41169

Summary: Patch for X font server rc script
Product: [Retired] Red Hat Linux Reporter: Hao Li <hli>
Component: XFree86Assignee: Mike A. Harris <mharris>
Status: CLOSED RAWHIDE QA Contact: David Lawrence <dkl>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.1   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2001-05-19 18:42:37 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:
Attachments:
Description Flags
Here is the patch again. none

Description Hao Li 2001-05-17 23:21:15 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.77 [en] (X11; U; Linux 2.4.1 i686; Nav)

Description of problem:
The commands to search for TrueType fonts have at least two problems:

1. "ls" can show multiple files per line. Using "egrep -v" on such results
obviously can throw away some files that shouldn't have been excluded.

2. TrueType fonts can end with either ttf or ttc.

The huge indenting which make lines longer than 80 chars are very annoying
too ...

Hence the patch:

--- xfs.orig    Fri Mar 30 18:51:56 2001
+++ xfs Thu May 17 16:12:16 2001
@@ -32,7 +32,7 @@
                        fi
                        if [ "$NEEDED" = "yes" ]; then
                                rm -f fonts.dir &>/dev/null
-                               if ls | grep \.ttf$ &>/dev/null; then
+                               if ls -1 | grep \.tt[fc]$ &>/dev/null; then
                                         # TrueType fonts found...
                                         ttmkfdir . >fonts.scale
                                         mkfontdir -e
/usr/X11R6/lib/X11/fonts/encodings \
@@ -40,7 +40,7 @@
                                         chmod a+r fonts.scale
                                         chmod a+r fonts.dir
                                 fi
-                               if [ "x`ls |egrep --ignore-case -v
'\.ttf$|^fonts\.|^encodings\.'`" != "x" ]; then
+                               if [ "x`ls -1 |egrep --ignore-case -v
'\.tt[fc]$|^fonts\.|^encodings\.'`" != "x" ]; then
                                         # This directory contains fonts
that are not TrueType...
 
                                         mkfontdir -e
/usr/X11R6/lib/X11/fonts/encodings \


How reproducible:
Always

Steps to Reproduce:
Look at the patch supplied ...

Additional info:

Comment 1 Hao Li 2001-05-17 23:23:58 UTC
Created attachment 18834 [details]
Here is the patch again.

Comment 2 Mike A. Harris 2001-05-19 08:50:07 UTC
If ls is used with output redirection of any type, it outputs one
column, not multiple.  To test this try this:
ls | less
ls > junk.txt
cat junk.txt
You'll see that there is one column, so problem #1 is no problem.  ;o)

#2 - I have never seen truetype fonts named .ttc, so I am hesitant to make
this change.  If any change should be made it would be best to use file(1)
to nail all valid files.  Doing such however is not super high priority, but
if I can't do it right away, I will consider the .ttc thing if you can
point out to me where the files come from, why the distinction with .ttc
instead of .ttf, and that the files are really working truetype fonts.

My reason for being so picky with this stuff is that there are lots of open
ttf font problems and I'm not anxious to risk making more.

#3 - I agree completely about the horrible indenting problem.  When I get
a chance I'll be redoing that script to use 2-4 spaces or so instead of
what looks like tab's.

Thanks.



Comment 3 Hao Li 2001-05-19 18:42:33 UTC
#1: Agreed. I mis-alarmed :(

#2: See http://www.xfree86.org/4.0.3/fonts5.html. I've seen some CJK fonts
ending with ttc under Win2k (but not WinNT). However I noticed that ttmkfdir
doesn't seem to generate the font.dir lines correctly for ttc files, i.e., I am
getting things like:
	simsun.ttc -misc-SimSun-medium-r-normal--0-0-0-0-p-0-ascii-0
while according to the webpage above I should get:
	:1:simsun.ttc -misc-SimSun-medium-r-normal--0-0-0-0-p-0-ascii-0
but this is another issue than what we are are talking about here.


Comment 4 Mike A. Harris 2001-08-13 23:22:44 UTC
Initial problem reported is now fixed in XFree86 4.1.0-0.9.12 internally,
will be in rawhide shortly.