Skip to Content.
Sympa Menu

freetds - RE: [freetds] 0.63 Release Candidate 7

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "ZIGLIO, Frediano, VF-IT" <Frediano.Ziglio AT vodafone.com>
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: RE: [freetds] 0.63 Release Candidate 7
  • Date: Fri, 7 Jan 2005 17:18:21 +0100

>
> > > "James K. Lowden" <jklowden AT schemamania.org> wrote:
> > > src/dblib/unittests/rpc is broken in RC6 and HEAD. I
> think it might
> > be
> > > the test; I'm not sure if it's valid to fetch the parameter's name
> > after
> > > dbresults() returns no more results. In any case, when we get to
> > >
> > > fprintf(stdout, "'%s' instead.\n", retname);
> > >
> > > retname points to outer space.
> >
> > I really don't understand. I looked at your change and I don't
> > understand what should be changed... Yesterday I tought that problem
> was
> > using mssql (I had only a Sybase server to test) but today I tested
> with
> > mssql2k (newer and former test version) and I don't notice any
> > problem...
>
> while dbresults() {
> while dbnextrow() [
> }
> if dbnumrets() {
> name = dbretname()
> }
> }
> puts(name);
>
> Question: what is the lifetime of the memory pointed to by the return
> value of dbretname()? Can it be expected to remain unfreed after
> dbresults() returns NO_MORE_RESULTS? I think the answer is no.
>

You are right! However I would have suggest a name = strdup(dbretname())
instead.

> I know the unit test segfaulted on fprintf() trying to derereference
> retname. I didn't check rcp.c to see whether the pointer had been
> freed. Depending on your machine, of course, dereferencing a freed
> value might or might not cause a problem.
>
> If you think I'm misreading the docs, or you know that a vendor's
> implementation (consistently) allows the above, then we ensure
> dbretname()'s return buffer isn't freed until it's reused.
> If it turns
> out it's not being freed, then I guess I'll have to look into what's
> happening on my box.
>
> BTW, I was confused for a bit, I think by libtool. The unit test
> executables have moved, and unless you've done a "make clean" lately,
> you might be picking up the old ones:
>
> $ file $(find build/src/dblib/ -name rpc) | cut -b-63
> build/src/dblib//unittests/.libs/rpc: ELF 32-bit LSB executable
> build/src/dblib//unittests/rpc: ELF 32-bit LSB executable
>
> $ ls -ghn $(find build/src/dblib/ -name rpc)
> -rwxr-xr-x 1 100 33K Mar 25 2004
> build/src/dblib//unittests/.libs/rpc
> -rwxr-xr-x 1 100 45K Jan 5 13:38 build/src/dblib//unittests/rpc
>
> It used to be that unittests/.libs/rpc was the binary and
> unittests/rpc
> was a script that called the binary. Nowadays the .lib
> directory isn't
> even created.
>

I know. I added -no-install to AM_LDFLAGS some months ago. It cause
libtool to not create executable and script but only executable. libtool
create script and executable to override some environment during
install. This it's needed cause installed reside in a different path.

freddy77




Archive powered by MHonArc 2.6.24.

Top of Page