Greg Stein wrote:
On Thu, Feb 27, 2003 at 12:11:18PM +1100, Stas Bekman wrote:

...
Assuming that my patch to handle the segfault in apr_uri_unparse goes in before the next -gold release, how am I supposed to handle the older apr (since modperl has to support older apr as well). Currently it seems that I have to do the following:


#if APR_MINOR_VERSION == 9 &&
(APR_PATCH_VERSION < 2 || APR_PATCH_VERSION == 2 && APR_IS_DEV_VERSION)
    /* apr < 0.9.3 segfaults if hostname is set, but scheme is not */
    if (uptr->hostname && !uptr->scheme) {
        uptr->scheme = "http";
    }
#endif

that's a way too messed up.


You have to use a runtime check. It is too easy to slide in a library that
is different from what you compiled against. Our compatibility guidelines
are designed specifically to enable that kind of forward/backward change.

Compile-time checks are only useful to look for API changes as a way to
decide how to call into APR. If the API is the same, and you're trying to
test for an underlying bug, then you'll need to use a runtime check.

And all of this remains a bit fuzzier during pre-1.0 days. It might be
possible in certain cases to look for bug fixes, and rely on incompatible
APIs between patch levels to prevent the erroneous usage of an older
library. But that's your call, and to be made on a case-by-case basis.

Greg, I'm not following you 100%.

If the app was compiled against specific apr_version.h, why not have a check at the boot time whether the binary library matches? That's what httpd does for modules it tries to load. Can't we do the same for apr?

So assuming that the compatibility check is done at the boot time and I know that some bug was fixed in:
APR_MINOR_VERSION == 9 && APR_PATCH_VERSION == 2 && !APR_IS_DEV_VERSION
can I use the compile time check?


Finally the run-time check that you are talking about is the following?
APR_DECLARE(void) apr_version(apr_version_t *pvsn);

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com



Reply via email to