[Fontconfig] Patch: fix for fc-cache with relative path

Patrick Lam plam at MIT.EDU
Fri Jan 6 22:53:47 PST 2006

On Wed, 4 Jan 2006, Frederic Crozat wrote:

> the new cache location code has introduced new bugs in fontconfig :
> -when using fc-cache . in a directory, the string used to generate
> md5sum key is always "./fonts.cache-2" which will collide if the same
> command is run in several directories.
> -a similar problem happen when using : fc-cache /foo/bar and
> fc-cache /foo/bar/ : strings used to generate md5sum are not the same,
> resulting in different cache.

I can fix the second problem but not the first.

> The attached patch fixes the issue.

I was looking for something like realpath.  Unfortunately, realpath 
doesn't quite seem to be what we want, since its manpage says:


Avoid using this function. It is broken by design since (unless using the 
non-standard resolved_path == NULL feature)  it is impossible to determine 
a suitable size for the output buffer, resolved_path. According to POSIX a 
buffer of size PATH_MAX suffices, but PATH_MAX need not be a defined 
constant, and may have to be obtained using pathconf().  And asking 
pathconf() does not really help, since on the one hand POSIX warns that 
the result of pathconf() may be huge and unsuitable for mallocing memory. 
And on the other hand pathconf() may return -1 to signify that PATH_MAX is 
not bounded.


More information about the Fontconfig mailing list