[PATCH] Improving _XimParseStringFile

James Cloos cloos at jhcloos.com
Fri Apr 10 11:12:08 PDT 2009


>>>>> "Cedric" == Cedric BAIL <cedric.bail at free.fr> writes:

>> I thought that's what was done by the mkcomposecache changes that SuSE
>> contributed a few years ago, but I don't think many people updated their
>> packages to build compose caches.

Cedric> How can I activate this ? And what about making it on by default ?

A quick test of « ./configure --help » shows:

  --disable-composecache  Disable compose table cache support

which implies that --enable-composecache is the default.

A « git grep cache » shows that modules/im/ximcp/imLcIm.c is the
interesting src file and these interesting defines:

/* include trailing '/' for cache directory, file prefix otherwise */
#define XIM_GLOBAL_CACHE_DIR "/var/cache/libx11/compose/"
#define XIM_HOME_CACHE_DIR   "/.compose-cache/"

And later in that file, one sees that the code first checks
getenv("XCOMPOSECACHE") with this comment:

 /* Usage: XCOMPOSECACHE=<cachedir>[=<filename>]
  * cachedir: directory of cache files
  * filename: internally used name for cache file */

If that does not work it tries to open the cache file in
XIM_GLOBAL_CACHE_DIR and if that also fails in
getenv("HOME") XIM_HOME_CACHE_DIR.

So it should just work.  (Has been, for me, for years.)

If it is not for you, you either need to make sure HOME is set in the
environment, make sure /var/cache/libx11/compose/ exists and has
suitable permissions or set XCOMPOSECACHE.

I would note that there is a comment in the code that it ought to use
getpwent(3) instead of getenv("HOME"), but the author was apparently
unsure whether that was supported on all platforms.  If your environment
does not set HOME, that would explain why you are missing out on the
cache.

-JimC
-- 
James Cloos <cloos at jhcloos.com>         OpenPGP: 1024D/ED7DAEA6


More information about the xorg-devel mailing list