Skip to Content.
Sympa Menu

freetds - Re: Crash in tsql

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Lowden, James K" <LowdenJK AT bernstein.com>
  • To: "'TDS Development Group'" <freetds AT franklin.metalab.unc.edu>
  • Subject: Re: Crash in tsql
  • Date: Tue, 13 Aug 2002 12:53:19 -0400


> From: Brian Bruns [mailto:camber AT ais.org]
> Sent: August 13, 2002 12:10 PM
>
> > > Actually, this fix is bad, since we don't distribute config.h
> > > (nor should we) things won't build.
> >
> > I don't understand that sentence. Could you unpack it for
> > me, please?
>
> Ok, config.h is a build time header that doesn't not end up in
> /usr/local/freetds/include. It's only there to avoid having
> a million -D HAVE_FOO arguments on the make line.
>
> Now, take an application like tsql that may be compiled outside of the
> freetds tree. Obviously, it can not rely on the HAVE_* macros being
> defined. Since tds.h is distributed (ends up in
> freetds/include) and used
> by third party apps, this is a problem.
>
> > > We simply can't be checking HAVE_ICONV in tds.h (or any
> distributable
> > > header). We could substitute from configure but that
> strikes me as
> > > sloppy. Any other options?
>
> The basic problem is we conditionally define part of
> TDSSOCKET based on a
> compile time #define, bad form on my part. So, the iconv checking in
> configure.in is just fine, how we use it during build is flawed. This
> wouldn't be a problem except that iconv_t relies on iconv.h
> and therefore may not be available.

I think I get it, and I have a suggestion for you.

1. Define the type inconv_t in much the same way you define
smallint/int/real in configure.in. If HAVE_ICONV is true, use it, else make
one up (hold that thought).

2. Define a structure in tds.h.in:

struct _inconv_io
{
iconv_t cdto, cdfrom;
} ICONV_IO;

3. Change TDSSOCKET to include a pointer to an ICONV_IO structure. In
the socket initialization code, you'll have to allocate that structure on
the heap, but that's what you're doing anyway for other stuff. If
HAVE_ICONV is false, of course, you set the pointer to null, or possibly to
some static structure useful for iconvless byte stripping.

Would that do the trick?

--jkl


The information contained in this transmission may contain privileged and
confidential information and is intended only for the use of the person(s)
named above. If you are not the intended recipient, or an employee or agent
responsible for delivering this message to the intended recipient, any
review, dissemination, distribution or duplication of this communication is
strictly prohibited. If you are not the intended recipient, please contact
the sender immediately by reply e-mail and destroy all copies of the
original message. Please note that for certain accounts we do not accept
orders and/or instructions by e-mail, and for those accounts we will not be
responsible for carrying out such orders and/or instructions. Kindly refrain
from sending orders or instructions by e-mail unless you have confirmed that
we accept such communications for your account. Please also note that to
satisfy regulatory requirements we review the outgoing and incoming e-mail
correspondence of staff members serving certain functions.






Archive powered by MHonArc 2.6.24.

Top of Page