[PATCH] Cache xkbcomp output

Colin Walters walters at verbum.org
Fri Jul 13 06:40:35 PDT 2012

On Thu, 2012-07-12 at 21:47 -0700, Keith Packard wrote:
> Colin Walters <walters at verbum.org> writes:
> > It'd be nicer if X shipped a binary to run which did whatever is
> > necessary to ensure the cache is valid, and update it.  That keeps the
> > implementation details of the caching contained where it should be, and
> > not duplicated around in the various rpm/deb/other postinst script
> > formats.
> Ok, that's easy enough. Do you want this script to actually clean the
> directory, removing the *.xkm files?

For the GTK+ icon cache, it has a "--force" option to do that, but I
think it's a fine default to only stat() the toplevel directory and exit
immediately if the cache timestamp is newer.

One thing that's relevant here is that I've been doing some work on
fully atomic upgrades, and in my system there is this special class of
things called "triggers" which are like "%post" from RPM or postinst
from .debs, except they have these additional constraints:

* Must be idempotent
* Must be filesystem-atomic; do the Unix open-temp-file-and-rename()
  dance, don't open any cache files for writing directly
* May be run in a chroot, must not rely on system services (dbus, etc.)
* Must be able to handle being run as root or non-root (i.e. don't
  abort if /usr/share/xkb/whatever isn't owned by uid 0)

(Also, they get extra code review, hopefully from at least 3 people).

What's relevant particularly here is that the cache file write be
atomic; I'm not seeing in your patch the code to write it, but hopefully
it is atomic.

More information about the xorg-devel mailing list