|
Description
|
There's a library called libfontconfig that's part of the open source Gnome desktop.
Its used by GTK apps and also by JDK to find fonts.
It turns out that libfontconfig uses fopen() which if you read up on solaris bug
1085341 : 32-bit stdio routines should support file descriptors >255
you'll find can be a bit of a problem for many apps and a victim
of note is netbeans 5.0 on 32 bit Solaris 10 using JDK 1.5 or JDK6.
netbeans 5 seems to have open > 500 jar files (wow!).
So when a user tried to view the font list, JDK
invoked fontconfig to get the list of fonts. It failed because
fontconfig (fopen) couldn't use the returned file descriptor.
All the user sees is a message :
Fontconfig error: Cannot load default config file
In practice the consequences are limited because JDK has hardwired
a comprehensive list of expected Solaris font directories and this
acts as a fallback. The most obvious consequence is fonts in your
personal ~/.fonts folder are not located by the fallback code - only
by fontconfig as ~/.fonts is a fontconfig "thing" (so far as I know).
The font code needs to use this lib since you can't reserve file descriptors.
The current in development fontconfig (2.3.92) has replaced its previous
cache (in build 2.3.90) with an mmap'ed one so has minimised the uses
of fopen() down to one - it happens to be a critical one still -
fcxml.c: f = fopen ((char *) filename, "r");
but it seems that its heading in the right direction, and we should pull
that into Solaris, further fix it and issue it as a patch.
We should avoid using these routines in libs which may be linked by
other programs that need to use > 256 fds
One of the fontconfig maintainers is updating the current version to remove
the last fopen. here's the content of his email on the fontconfig list
where he says he'll do it. This should be in fontconfig 2.3.93 and later I think.
-------------------------------------------------
>The mmap cache removed all but one usage of "fopen" from the source.
>>
>> grep fopen *c
>> fcxml.c: f = fopen ((char *) filename, "r");
>>
>> On 32 bit solaris an unsigned char is used for the file descriptor
>> in stdio routines and I gather (ancient solaris bug 1085341) that
>> fixing this would require an ABI change and it couldn't be done.
>> I wonder if it would be possible to get rid of that too and replace it
>> with "open" at least perhaps in an #ifdef for 32 bit Solaris.
There's no need to use fopen there. I've replaced it with open and will
commit momentarily.
pat
-------------------------------------------------
|