Bug 173875

Summary: mkfontscale can't find encodings.dir
Product: [Fedora] Fedora Reporter: sangu <sangu.fedora>
Component: libfontencAssignee: Mike A. Harris <mharris>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: eng-i18n-bugs, xgl-maint
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-03-02 17:01:49 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 150222    
Description Flags
$starce /usr/bin/mkfontscale -a fontpath
mkfontscale's strace filei n libfontenc-0.99.2-2
Doing mkfontscale fonts korean, strace.txt
$rpm -ql xorg-x11-fonts-base and $ls -alFR /usr/share/X11/fonts/encodings
$ strace mkfontscale > strace.txt 2>&1 in korean fonts directory
diff of spec file changes for peer review
$/usr/bin/strace mkfontscale -n -e `/usr/share/fonts/japanese/TrueType/ > ~/strace.txt 2>&1 none

Description sangu 2005-11-22 01:30:28 UTC
Description of problem:
$strace /usr/bin/mkfontscale -a fontpath
open("/usr/lib/X11/fonts/encodings/encodings.dir", O_RDONLY) = -1 ENOENT (No
such file or directory)

$ls /usr/share/X11/fonts/encodings/encodings.dir
$rpm -qf /usr/share/X11/fonts/encodings/encodings.dir

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. /usr/bin/mkfontscale -a fontpath
Actual results:

Expected results:

Additional info:

Comment 1 sangu 2005-11-22 01:30:28 UTC
Created attachment 121328 [details]
$starce  /usr/bin/mkfontscale -a fontpath

Comment 2 Mike A. Harris 2005-11-22 22:29:09 UTC
This turns out to be a bug in libfontenc, which mkfontscale links to.  It
is built with a hard coded path to the encodings files supplied by its

Comment 3 Mike A. Harris 2005-11-23 00:50:31 UTC
Fixed by applying libfontenc-0.99.2-use-datadir-for-encodings.patch which patches
Makefile.am, and calling automake.  This package will require
xorg-x11-filesystem also to be installed first, or at the same time.

Comment 4 sangu 2005-11-23 02:14:14 UTC
Created attachment 121380 [details]
mkfontscale's strace filei n libfontenc-0.99.2-2

still can't find encodings.dir
$ pwd
$ strace mkfontscale  > strace.txt  2>&1

# cat fonts.scale
$cat strace.txt
unlink("./encodings.dir")		= -1 ENOENT (No such file or directory)

exit_group(0)				= ?
Process 13550 detached

$ rpm -q libfontenc xorg-x11-font-utils

Comment 5 sangu 2005-11-23 02:33:20 UTC
Created attachment 121383 [details]
Doing mkfontscale fonts korean, strace.txt

$strace mkfontscale /usr/share/fonts/korean/TrueType > strace.txt 2>&1

Comment 6 sangu 2005-11-23 02:45:41 UTC
Sorry my misposting (comment 4, 5 ).

mkfontscale can't find enc files in /usr/share/X11/fonts/encoding/ and

open("/usr/share/X11/fonts/encodings/./*.enc", O_RDONLY) = -1 ENOENT
(No such file or directory)

Comment 7 Mike A. Harris 2005-11-23 13:18:06 UTC
Please provide output of:

rpm -q libfontenc libXfont xorg-x11-font-utils xorg-x11-fonts


rpm -ql xorg-x11-fonts-base

Comment 8 Mike A. Harris 2005-11-23 13:19:34 UTC
Also, please run:

rpm -V libfontenc libXfont xorg-x11-font-utils xorg-x11-fonts-base

Comment 9 Mike A. Harris 2005-11-23 13:21:50 UTC
And the output of "ls -alFR /usr/share/X11/fonts/encodings"

Comment 10 sangu 2005-11-23 13:39:01 UTC

$rpm -V libfontenc libXfont xorg-x11-font-utils xorg-x11-fonts-base

no message.

$ls -alFR /usr/share/X11/fonts/encodings
total 184
drwxr-xr-x 3 root root 4096 Nov 22 02:43 ./
drwxr-xr-x 8 root root 4096 Nov 15 04:38 ../
-rw-r--r-- 1 root root 3253 Nov 15 04:35 adobe-dingbats.enc.gz
-rw-r--r-- 1 root root 1655 Nov 15 04:35 adobe-standard.enc.gz
-rw-r--r-- 1 root root 3165 Nov 15 04:35 adobe-symbol.enc.gz
-rw-r--r-- 1 root root  986 Nov 15 04:35 ansi-1251.enc.gz
-rw-r--r-- 1 root root 1026 Nov 15 04:35 armscii-8.enc.gz
-rw-r--r-- 1 root root  435 Nov 15 04:35 ascii-0.enc.gz
-rw-r--r-- 1 root root  582 Nov 15 04:35 dec-special.enc.gz
-rw-r--r-- 1 root root 4581 Nov 15 04:35 encodings.dir
-rw-r--r-- 1 root root 8192 Nov 17 01:02 fonts.cache-2
-rw-r--r-- 1 root root    2 Nov 17 02:46 fonts.dir
-rw-r--r-- 1 root root 1576 Nov 15 04:35 ibm-cp437.enc.gz
-rw-r--r-- 1 root root 1519 Nov 15 04:35 ibm-cp850.enc.gz
-rw-r--r-- 1 root root 1412 Nov 15 04:35 ibm-cp852.enc.gz
-rw-r--r-- 1 root root 1373 Nov 15 04:35 ibm-cp866.enc.gz
-rw-r--r-- 1 root root 1012 Nov 15 04:35 iso8859-11.enc.gz
-rw-r--r-- 1 root root  639 Nov 15 04:35 iso8859-13.enc.gz
-rw-r--r-- 1 root root  626 Nov 15 04:35 iso8859-16.enc.gz
-rw-r--r-- 1 root root  996 Nov 15 04:35 iso8859-6.16.enc.gz
-rw-r--r-- 1 root root  836 Nov 15 04:35 iso8859-6.8x.enc.gz
drwxr-xr-x 2 root root 4096 Nov 22 02:43 large/
-rw-r--r-- 1 root root  616 Nov 15 04:35 microsoft-cp1250.enc.gz
-rw-r--r-- 1 root root 1181 Nov 15 04:35 microsoft-cp1251.enc.gz
-rw-r--r-- 1 root root  529 Nov 15 04:35 microsoft-cp1252.enc.gz
-rw-r--r-- 1 root root 1219 Nov 15 04:35 microsoft-cp1253.enc.gz
-rw-r--r-- 1 root root  572 Nov 15 04:35 microsoft-cp1254.enc.gz
-rw-r--r-- 1 root root 1004 Nov 15 04:35 microsoft-cp1255.enc.gz
-rw-r--r-- 1 root root 1025 Nov 15 04:35 microsoft-cp1256.enc.gz
-rw-r--r-- 1 root root  883 Nov 15 04:35 microsoft-cp1257.enc.gz
-rw-r--r-- 1 root root  633 Nov 15 04:35 microsoft-cp1258.enc.gz
-rw-r--r-- 1 root root  435 Nov 15 04:35 microsoft-win3.1.enc.gz
-rw-r--r-- 1 root root  185 Nov 15 04:35 mulearabic-0.enc.gz
-rw-r--r-- 1 root root  455 Nov 15 04:35 mulearabic-1.enc.gz
-rw-r--r-- 1 root root  467 Nov 15 04:35 mulearabic-2.enc.gz
-rw-r--r-- 1 root root  676 Nov 15 04:35 mulelao-1.enc.gz
-rw-r--r-- 1 root root  811 Nov 15 04:35 suneu-greek.enc.gz
-rw-r--r-- 1 root root  760 Nov 15 04:35 tcvn-0.enc.gz
-rw-r--r-- 1 root root 1152 Nov 15 04:35 tis620-2.enc.gz
-rw-r--r-- 1 root root 1242 Nov 15 04:35 viscii1.1-1.enc.gz

total 672
drwxr-xr-x 2 root root  4096 Nov 22 02:43 ./
drwxr-xr-x 3 root root  4096 Nov 22 02:43 ../
-rw-r--r-- 1 root root 64391 Nov 15 04:35 big5.eten-0.enc.gz
-rw-r--r-- 1 root root 85290 Nov 15 04:35 big5hkscs-0.enc.gz
-rw-r--r-- 1 root root 29725 Nov 15 04:35 cns11643-1.enc.gz
-rw-r--r-- 1 root root 36755 Nov 15 04:35 cns11643-2.enc.gz
-rw-r--r-- 1 root root 26146 Nov 15 04:35 cns11643-3.enc.gz
-rw-r--r-- 1 root root  1769 Nov 15 04:35 encodings.dir
-rw-r--r-- 1 root root  8192 Nov 17 01:02 fonts.cache-2
-rw-r--r-- 1 root root   140 Nov 15 04:35 gb18030-0.enc.gz
-rw-r--r-- 1 root root 65458 Nov 15 04:35 gb18030.2000-0.enc.gz
-rw-r--r-- 1 root root  1677 Nov 15 04:35 gb18030.2000-1.enc.gz
-rw-r--r-- 1 root root 70467 Nov 15 04:35 gb2312.1980-0.enc.gz
-rw-r--r-- 1 root root 59166 Nov 15 04:35 gbk-0.enc.gz
-rw-r--r-- 1 root root   453 Nov 15 04:35 jisx0201.1976-0.enc.gz
-rw-r--r-- 1 root root 72764 Nov 15 04:35 jisx0208.1990-0.enc.gz
-rw-r--r-- 1 root root 23852 Nov 15 04:35 jisx0212.1990-0.enc.gz
-rw-r--r-- 1 root root 34763 Nov 15 04:35 ksc5601.1987-0.enc.gz
-rw-r--r-- 1 root root 32497 Nov 15 04:35 ksc5601.1992-3.enc.gz
-rw-r--r-- 1 root root   938 Nov 15 04:35 sun.unicode.india-0.enc.gz

Comment 11 Mike A. Harris 2005-12-21 11:25:03 UTC
I believe this problem is resolved in rawhide for a while now.  Please

Comment 12 sangu 2005-12-22 10:57:07 UTC
Created attachment 122522 [details]
$rpm -ql xorg-x11-fonts-base and $ls -alFR /usr/share/X11/fonts/encodings

mharris : this problem still happens.

$ rpm -q libfontenc libXfont xorg-x11-font-utils 

$rpm -qa | grep xorg-x11-fonts

$ rpm -V libfontenc libXfont xorg-x11-font-utils
no message

Comment 13 sangu 2005-12-22 11:04:32 UTC
Created attachment 122523 [details]
$ strace mkfontscale > strace.txt 2>&1 in korean fonts directory

in strace.txt
open("/encodings/encodings.dir", O_RDONLY) = -1 ENOENT (No such file or

Comment 14 Mike A. Harris 2006-02-21 11:37:29 UTC
Does this problem still occur with FC5test3?

Comment 15 sangu 2006-02-23 09:05:06 UTC
this problem still happens in FC5T3

$rpm -q libfontenc libXfont xorg-x11-font-utils

$rpm -qa | grep xorg-x11-fonts

$rpm -V libfontenc libXfont xorg-x11-font-utils
no message

Comment 16 Mike A. Harris 2006-02-24 13:14:36 UTC
Ok, I've reproduced this by copying the bitstream-vera fonts into
/tmp/fonts and running:

strace mkfontscale > strace.out 2>&1

Examining the log I see similar file not found complaints as you're
reporting.  What was odd, is that it looks for some files *.enc, and
other files as *.enc.gz

When you look in the system encodings directories however, *all* of the
files are "*.enc.gz".  The list of encodings files come from the
encodings.dir files present in each of the encodings directories.  If you
look at the contents of these encodings.dir files, you find entries that
seem to be randomly put there, some *.enc, some *.enc.gz, and various of
the files simply do not exist at all in the actual system.

I attempted to work around the problem by recreating the encodings.dir files
with mkfontscale in each encodings directory, by doing:

cp encodings.dir encodings.dir.ORIG
mkfontscale -e . -n

I repeated this in the 'large' dir as well.  This created new encodings.dir
files in each of the encodings directories, and when mkfontscale was ran on
the test font directory I created earlier, the second strace did not show
any errors.

So, in a pinch, I can work around this bug by manually invoking
"mkfontscale -e $encodingdir -n" in each encoding dir in the fonts rpm,
which will recreate the proper encodings.dir files in our rpm packaging
at least.

I'm curious though why this is happening in the first place, and am going
to dig into it further.  Either the encodings.dir files are getting
generated incorrectly in the encodings.*.tar.bz2 build in xorg-x11-fonts,
or they're getting generated and discarded, or there are pregenerated
bogus encodings.dir files stored in the CVS repo that just get copied into
the output dir when building the package.  That's my current theory anyway.

Will report back shortly with my results.

Comment 17 Mike A. Harris 2006-02-24 14:58:13 UTC
Ok, I've changed the file manifest to mark the encodings.dir files in
the encodings directories as %ghost files, so that the rpm package
build time encodings.dir files are not used.  Then I updated the
base-fonts rpm %post script to create the encodings.dir files via
mkfontscale at package _install_ time.  This is more consistent with
how fonts.dir files are created, so I'm hoping it works out to be
a better solution.

I have tested the updated xorg-x11-fonts-base package locally by installing
and removing it, and it now installs encodings.dir files that properly match
the *.enc.gz files which are provided by the encodings tarball.

There are a few things I'm not 100% certain of however.  I'm not sure if
these files end up getting updated at runtime when mkfont* get invoked during
font rpm package installation/removal or not.

So, while this fix fixes the problem reported here, and does so in a manner
consistent with our other font file installation and whatnot, it could
possibly uncover additional bugs which were dormant.

There is a possibility that this could potentially regress OS installation
or upgrades, if mkfontscale and mkfontdir act differently now than they
have prior to this change.  However it is equally possible that this change
may also fix other bugs which were caused due to the encodings.dir files
being built incorrectly by the X.Org Makefiles.

Since there is some potential risk to including this fix in FC5 at this point,
I am building test packages outside of rawhide, and will make them available
on people.redhat.com for people to test.  I will then post to the fedora
lists to gather testers to bang on the package(s) and see what if anything

Stay tuned...

Comment 18 Mike A. Harris 2006-02-24 15:01:03 UTC
Created attachment 125179 [details]
diff of spec file changes for peer review

Comment 19 Mike A. Harris 2006-02-27 13:58:21 UTC
I posted rpm packages for people to test to Fedora devel and test list, and
got several people to confirm things work for them with the new packages.

Since they work for me too, I'm moving the new xorg-x11-fonts-7.0-2 packages
to Fedora Devel today.

Comment 20 Mike A. Harris 2006-02-28 06:28:33 UTC
Fixed in rawhide xorg-x11-fonts-7.0-2

Comment 21 sangu 2006-02-28 11:30:48 UTC
Created attachment 125392 [details]
$/usr/bin/strace mkfontscale -n -e `/usr/share/fonts/japanese/TrueType/ > ~/strace.txt 2>&1

sorry about late response.
$/usr/bin/strace mkfontscale -n -e `/usr/share/fonts/japanese/TrueType/ >
~/strace.txt 2>&1

mkfontscale doesn't find encoding in large directory.

Comment 22 Mike A. Harris 2006-03-02 17:01:49 UTC
This bug started out as a libfontenc bug, and each fix has uncovered a
separate bug/problem.  It is prefered to have new bug reports opened for
each new bug that pops up so it is easier to track each issue without
having to sort through old bug comments that are no longer relevent.

I have examined and verified that the encodings.dir files created during
package installation time, properly represent the encodings files in the
given directory, for both the large and non-large encodings.