[augeas-devel] Proper locale support

David Lutterkort lutter at redhat.com
Fri Oct 23 17:30:07 UTC 2009


This series of patches addresses an issue with using libaugeas with non-C
locales (ticket #35). Augeas requires that all regular expressions are
interpreted in the C locale, in particular, things go horribly wrong for
character ranges like [a-z] when the locale is not C. This problem was so
far not visible with augtool and augparse, since they always used the C
locale.

Unfortunately, the glibc (and gnulib) regexp matcher will always use the
current locale, and can't be told to use an explicit locale.

The issue is addressed in two ways:

  * on systems that have uselocale(), we switch to the C locale every time
    we enter through a public API function, and switch back to the old
    locale on exit
  * things are hairier (and more expensive) if the system doesn't have
    uselocale(): there we resort to rewriting regular expressions ourselves
    and expand character ranges before passing the regexps to the
    matcher. The rewriting leads to some horendously big regular
    expressions

I'd be very thankful for any pointers to solving this short of writing my
own regexp matcher.

David




More information about the augeas-devel mailing list