[freetds] 0.62rc3 + Sybase ASA: good except tsql - here's a patch

James K. Lowden jklowden at schemamania.org
Thu Jan 8 23:44:26 EST 2004


On Thu, 8 Jan 2004, L J Bayuk <ljb220 at mindspring.com> wrote:
> [Sorry - I didn't mean to wait until just before release, but my last 2
> tries at posting this went nowhere. 

Vaporized without a trace?  

> I think your mail list server hates me.]

Hate from a machine is really no different than love from a machine.  At
least, I can never tell the difference.  

> I'm using FreeTDS-0.62rc3 (on Linux/i386) talking to Sybase ASA 8.0.2 on
> Netware 6. I built FreeTDS with sqsh-2.1 and PHP-4.3.3 (sybase_ct
> extension), both of which work fine. (0.61* was not usable for me with
> ASA.)

(Progress.)  :-)

> tsql crashes (segfault) on connecting to ASA.  
...
> The crash is in tds/iconv.c when tds_srv_charset_changed() calls
>      strcmp(canonic_charset, iconv_info->server_charset.name)
> with canonic_charset==NULL.  What happens: tsql sent charset
> "ANSI_X3.4-1968" (I have no clue where it got that) 

To answer your question, it got that from nl_langinfo(3).  

That's the actual problem, I think.  If it's to do anything of the kind,
tsql should request a character set from ASA using Sybase's nomenclature. 
In this case, afaik that would be "iso_1".  

Thanks for the patch.  If we're going to die on a NULL pointer, we should
do it intelligently, with assert().  In this case I agree, it's better to
soldier on.  That way, the application can trap the message and adapt. 
You do see a message from the server, don't you?  

--jkl

> --- src/tds/iconv.c.bak 2003-12-29 11:08:35.000000000 -0500
> +++ src/tds/iconv.c     2004-01-07 08:53:17.000000000 -0500
> @@ -959,6 +959,10 @@
>         TDSICONVINFO *iconv_info =
>         tds->iconv_info[client2server_chardata]; const char
>         *canonic_charset = tds_canonical_charset_name(charset);
>  
> +       /* ignore request to change to unknown charset */
> +       if (!canonic_charset)
> +               return;
> +
>         if (strcmp(canonic_charset, iconv_info->server_charset.name) ==
>         0)
>                 return;


More information about the FreeTDS mailing list