You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Bob Rossi <bo...@cox.net> on 2008/05/17 04:43:11 UTC
upgrading from 2006 snapshot to apr-1.3.x
Hi,
I just upgraded to the 1.3 svn snapshot, to test out the new
functionality that was recently added. After I ran my unit tests I
noticed that the function apr_dbd_init() was not working properly for
me. Then I realized it's because this code,
#ifndef APU_DSO_BUILD
/* Load statically-linked drivers: */
#if APU_HAVE_MYSQL
DRIVER_LOAD("mysql", apr_dbd_mysql_driver, pool);
#endif
#if APU_HAVE_PGSQL
DRIVER_LOAD("pgsql", apr_dbd_pgsql_driver, pool);
#endif
#if APU_HAVE_SQLITE3
DRIVER_LOAD("sqlite3", apr_dbd_sqlite3_driver, pool);
#endif
#if APU_HAVE_SQLITE2
DRIVER_LOAD("sqlite2", apr_dbd_sqlite2_driver, pool);
#endif
#if APU_HAVE_ORACLE
DRIVER_LOAD("oracle", apr_dbd_oracle_driver, pool);
#endif
#if APU_HAVE_SOME_OTHER_BACKEND
DRIVER_LOAD("firebird", apr_dbd_other_driver, pool);
#endif
#endif /* APU_DSO_BUILD */
is not in the translation unit anymore.
Any idea why this would have changed? Something I did wrong?
Thanks,
Bob Rossi
Re: upgrading from 2006 snapshot to apr-1.3.x
Posted by Bojan Smojver <bo...@rexursive.com>.
On Sat, 2008-05-17 at 06:56 -0400, Bob Rossi wrote:
> char path[80];
Yeah, most likely should be APR_PATH_MAX+1, or something.
--
Bojan
Re: upgrading from 2006 snapshot to apr-1.3.x
Posted by Bojan Smojver <bo...@rexursive.com>.
On Sat, 2008-05-17 at 07:21 -0400, Bob Rossi wrote:
> Just tried it, my tests pass now, which means this works. Should
> --disable-shared force --disable-dbd-dso?
It does disable it - drivers don't work :-)
(Sorry, couldn't resist to be a smartarse).
Seriously, this could be done for convenience, but we may just mention
it in README or some other doco.
> Also, the "path" issue is pretty serious imo.
Yeah, I think we should make it bigger than 80.
--
Bojan
Re: upgrading from 2006 snapshot to apr-1.3.x
Posted by Bob Rossi <bo...@cox.net>.
On Sat, May 17, 2008 at 09:10:50PM +1000, Bojan Smojver wrote:
> On Sat, 2008-05-17 at 06:56 -0400, Bob Rossi wrote:
>
> > Huh, I build with --disable-shared --enable-static. Perhaps it doesn't
> > work in this configuration?
>
> Possibly. Have you tried with --disable-dbd-dso?
Just tried it, my tests pass now, which means this works. Should
--disable-shared force --disable-dbd-dso? Also, the "path" issue is
pretty serious imo.
Thanks,
Bob Rossi
Re: upgrading from 2006 snapshot to apr-1.3.x
Posted by Bojan Smojver <bo...@rexursive.com>.
On Sat, 2008-05-17 at 06:56 -0400, Bob Rossi wrote:
> Huh, I build with --disable-shared --enable-static. Perhaps it doesn't
> work in this configuration?
Possibly. Have you tried with --disable-dbd-dso?
--
Bojan
Re: upgrading from 2006 snapshot to apr-1.3.x
Posted by Bob Rossi <bo...@cox.net>.
On Sat, May 17, 2008 at 06:56:28AM -0400, Bob Rossi wrote:
> On Sat, May 17, 2008 at 01:08:59PM +1000, Bojan Smojver wrote:
> > On Fri, 2008-05-16 at 22:43 -0400, Bob Rossi wrote:
> >
> > > I just upgraded to the 1.3 svn snapshot, to test out the new
> > > functionality that was recently added. After I ran my unit tests I
> > > noticed that the function apr_dbd_init() was not working properly for
> > > me. Then I realized it's because this code,
> >
> > With 1.3.x and above, we build DBD modules as DSOs. Did they get built
> > properly?
>
> Huh, I build with --disable-shared --enable-static. Perhaps it doesn't
> work in this configuration? I do see,
>
> $ ls apr-util-1.3.x-2008-05-16-cvs/
> bin include lib
>
> $ ls apr-util-1.3.x-2008-05-16-cvs/lib
> apr-util-1 aprutil.exp libaprutil-1.a libaprutil-1.la pkgconfig
>
> $ ls apr-util-1.3.x-2008-05-16-cvs/lib/apr-util-1/
> apr_dbd_pgsql.a apr_dbd_pgsql.la apr_dbd_sqlite3.a
> apr_dbd_sqlite3.la
>
> I'm thinking perhaps this doesn't work with --disable-shared. If I set a
> breakpoing in
> APU_DECLARE(apr_status_t) apr_dbd_get_driver(apr_pool_t *pool,
> const char *name, const apr_dbd_driver_t **driver)
> I can see that it does this,
> apr_snprintf(path, sizeof path, "%s/apr_dbd_%s.so", APU_DSO_LIBDIR, name);
>
> There is a couple of disturbing things here, for starters, the "path"
> variable declared on the stack is hard coded to a certain size,
>
> char path[80];
>
> my installation of apr-util is this long (in this circumstance)
> echo $PWD|wc -c
> 120
>
> I realy think that variable should be dynamic. ie. the length of
> APU_DSO_LIBDIR +
> 1 for '/' +
> 8 for "apr_dbd_" +
> name +
> 3 for .so +
> 1 for NULL
>
> since that is the longest possible name, that should cover the rest of
> the cases.
>
> So, it seems like there is 2 bugs here perhaps? Doesn't work with
> --disable-shared and the path variable is to small on the stack.
Here's the patch that overflowed the path variable,
http://svn.apache.org/viewvc/apr/apr-util/trunk/dbd/apr_dbd.c?view=log#rev555117
Bob Rossi
Re: upgrading from 2006 snapshot to apr-1.3.x
Posted by Bob Rossi <bo...@cox.net>.
On Sat, May 17, 2008 at 01:08:59PM +1000, Bojan Smojver wrote:
> On Fri, 2008-05-16 at 22:43 -0400, Bob Rossi wrote:
>
> > I just upgraded to the 1.3 svn snapshot, to test out the new
> > functionality that was recently added. After I ran my unit tests I
> > noticed that the function apr_dbd_init() was not working properly for
> > me. Then I realized it's because this code,
>
> With 1.3.x and above, we build DBD modules as DSOs. Did they get built
> properly?
Huh, I build with --disable-shared --enable-static. Perhaps it doesn't
work in this configuration? I do see,
$ ls apr-util-1.3.x-2008-05-16-cvs/
bin include lib
$ ls apr-util-1.3.x-2008-05-16-cvs/lib
apr-util-1 aprutil.exp libaprutil-1.a libaprutil-1.la pkgconfig
$ ls apr-util-1.3.x-2008-05-16-cvs/lib/apr-util-1/
apr_dbd_pgsql.a apr_dbd_pgsql.la apr_dbd_sqlite3.a
apr_dbd_sqlite3.la
I'm thinking perhaps this doesn't work with --disable-shared. If I set a
breakpoing in
APU_DECLARE(apr_status_t) apr_dbd_get_driver(apr_pool_t *pool,
const char *name, const apr_dbd_driver_t **driver)
I can see that it does this,
apr_snprintf(path, sizeof path, "%s/apr_dbd_%s.so", APU_DSO_LIBDIR, name);
There is a couple of disturbing things here, for starters, the "path"
variable declared on the stack is hard coded to a certain size,
char path[80];
my installation of apr-util is this long (in this circumstance)
echo $PWD|wc -c
120
I realy think that variable should be dynamic. ie. the length of
APU_DSO_LIBDIR +
1 for '/' +
8 for "apr_dbd_" +
name +
3 for .so +
1 for NULL
since that is the longest possible name, that should cover the rest of
the cases.
So, it seems like there is 2 bugs here perhaps? Doesn't work with
--disable-shared and the path variable is to small on the stack.
Thanks,
Bob Rossi
Re: upgrading from 2006 snapshot to apr-1.3.x
Posted by Bojan Smojver <bo...@rexursive.com>.
On Fri, 2008-05-16 at 22:43 -0400, Bob Rossi wrote:
> I just upgraded to the 1.3 svn snapshot, to test out the new
> functionality that was recently added. After I ran my unit tests I
> noticed that the function apr_dbd_init() was not working properly for
> me. Then I realized it's because this code,
With 1.3.x and above, we build DBD modules as DSOs. Did they get built
properly?
--
Bojan