Regexp library chaos

Apache makes some use of regular expressions, for which it uses the Perl-compatible regular expression (pcre) library. And it bundles the library rather than making it a prerequisite: a decision which causes a range of problems (for example here) and sort-of fixed in an uneasy compromise.

APR doesn’t use any regexp support. So when I found myself using regexps in developing a FreeTDS driver for apr_dbd, I faced the decision of whether to use pcre or POSIX regexps. Two ideas led me to pcre:

  • PCRE is nice, and much more versatile/powerful than the (much older) POSIX regexps.
  • The application is within Apache, which already uses PCRE.

However, I then have to link PCRE into apr-util, which then links into an httpd instance linking its own pcre. This caused a whole bunch of trouble, and since I’m under some pressure of time, I abandoned the attempt to make it work and reverted to POSIX regexps. These in turn caused grief until I remembered that little thing, the REG_EXTENDED flag that POSIX requires to enable regexp memory. And a reminder of platform issues, when I debugged in gdb and saw just how different the regexp implementation on the Client’s Solaris platform is from my Linux development platform!

Not a big deal. Just a b***** annoying waste of time on what should be a trivial issue. Grrr …

Posted on June 2, 2007, in apache. Bookmark the permalink. 1 Comment.

  1. So how about wrapping pcre in apr?
    If both httpd and some of the apr_dbd drivers need pcre, then that would seem an obvious fix.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: