[Fontconfig] Sigh. What to do about per-user fonts...

Patrick Lam plam at MIT.EDU
Mon May 8 10:38:13 PDT 2006


Keith Packard wrote:
> On Wed, 2006-05-03 at 23:09 -0400, Patrick Lam wrote:
> 
>> I noticed one problem which occurs when you run fc-cache as root and 
>> have HOME set to a user directory.  I'll have more details (hopefully a 
>> fix) when I next have free time on Friday or something.  Right now I'm 
>> preparing lecture notes...
> 
> I'm not quite sure what to do about that; one option is to strip all ~
> relative path names when getuid() != geteuid() from the font path, cache
> path and other configurable names.
> 
> I was thinking that we already bailed on writing out cache files in this
> case though. In which case, the only issue is with sudo. One possible
> fix here is to use getpwuid (getuid()) instead of getenv ("HOME").

We don't write global cache files in the getuid() != geteuid() case, but 
we do write local cache files.  So getpwuid(getuid()) seems like it 
should work.

I've looked at the patch and it seems generally correct to me.  Two 
questions:

1. Why did you move the #include "fcint.h" to the end of the 
include-block in fccfg.c?  We fixed some problems on Windows by putting 
it consistently at the beginning of the include block.  There's a bug 
about that somewhere.

2. Do we still need to do the check for mis-named cache files in 
DirCacheUnlink?  It seems like it wouldn't be a bad idea to 
unconditionally blow away anything that's in the way of what we're 
trying to unlink.

The patch also appears to work on my system, too, for what that's worth.

pat


More information about the Fontconfig mailing list