[freetds] Compiling on FreeBSD without ICONV

Alan Pettigrew alan at pettigrew.fsnet.co.uk
Tue Jun 10 09:06:01 EDT 2003

Here is some more trace from the crash.  It gets into connect, but doesn't
seem to return.
I have tried with and without a timeout, and interestingly connect always
seems to be trying to return EINPROGRESS.  This is the version with timeout.

open("/tmp/freetds.log", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 8
gettimeofday({1055242921, 538030}, NULL) = 0
fstat(8, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
write(8, "Starting log file for FreeTDS 0."..., 93) = 93
write(8, "names for ISO-8859-1: ISO-8859-1"..., 33) = 33
write(8, "names for UTF-8: UTF-8\n", 23) = 23
write(8, "names for UCS-2LE: UCS-2LE\n", 27) = 27
write(8, "names for UCS-2BE: UCS-2BE\n", 27) = 27
write(8, "iconv to convert client-side dat"..., 68) = 68
gettimeofday({1055242921, 540110}, NULL) = 0
write(8, "12:02:01.540110 tds_iconv_info_i"..., 72) = 72
gettimeofday({1055242921, 540572}, NULL) = 0
write(8, "12:02:01.540572 tds_iconv_info_i"..., 71) = 71
gettimeofday({1055242921, 541061}, NULL) = 0
write(8, "12:02:01.541061 Connecting to 10"..., 60) = 60
fcntl(9, F_GETFL)                       = 0x2 (flags O_RDWR)
fcntl(9, F_SETFL, O_RDWR|O_NONBLOCK)    = 0
setsockopt(9, SOL_SOCKET, SO_LINGER, [1], 8) = 0
setsockopt(9, SOL_SOCKET, SO_KEEPALIVE, [1], 4) = 0
gettimeofday({1055242921, 542712}, NULL) = 0
write(8, "12:02:01.542712 tds.s=0x9, sin=0"..., 97) = 97
connect(9, {sin_family=AF_INET, sin_port=htons(1433),
sin_addr=inet_addr("")}}, 16) = -1 EINPROGRESS (Operation now in
sigaction(SIGABRT, {SIG_DFL}, {SIG_DFL}) = 0
write(5, "Signal SEGV at /usr/local/lib/pe"..., 81) = 81
write(5, "\tDBI::connect(\'DBI\', \'DBI:ODBC:e"..., 119) = 119
write(5, "\tmain::open_database() called at"..., 55) = 55
kill(89855, SIGABRT <unfinished ...>

The gdb trace shows
(gdb) bt
#0  0x28176b0c in kill () from /usr/lib/libc.so.4
#1  0x28085a7e in Perl_apply () from /usr/lib/libperl.so.3
#2  0x2808f916 in Perl_pp_kill () from /usr/lib/libperl.so.3
#3  0x2807f11d in Perl_runops_standard () from /usr/lib/libperl.so.3
#4  0x280e96ad in perl_call_sv () from /usr/lib/libperl.so.3
#5  0x280bea01 in Perl_sighandler () from /usr/lib/libperl.so.3
#6  0xbfbfffac in ?? ()        <=============== looks strange
#7  0x281a13b6 in xdr_bytes () from /usr/lib/libc.so.4
#8  0x281a1488 in xdr_netobj () from /usr/lib/libc.so.4
#9  0x281b786a in .cerror () from /usr/lib/libc.so.4
#10 0x2835f1cf in tds_connect (tds=0x8306d00, connect_info=0x8306c00)
    at login.c:316
#11 0x2834edc6 in do_connect (dbc=0x8390ce0, connect_info=0x8306c00)
    at odbc.c:215

This gdb trace suggests that there is an interface problem, connect is
trying to return but is picking the wrong address off the stack.

I'm not sure what Perl is doing that stops things.


----- Original Message -----
From: "Alan Pettigrew" <freetds at pettigrew.fsnet.co.uk>
To: "FreeTDS Development Group" <freetds at lists.ibiblio.org>
Sent: Tuesday, June 10, 2003 9:46 AM
Subject: Re: [freetds] Compiling on FreeBSD without ICONV


The multi-hread version crashes very early on in isql and tsql.  I have
rebuild as --enable-threadsafe=no and it now runs.  I'm told that threading
on freeBSD and Linux are different, so I guess there is a basic problem.

Unfortunately I'm not a freeBSD expert, just a user at the moment.  If I
find anything out I will let you know.

I'm now back to the problem I had with 0.61, I cannot connect from Perl.  I
get a core dump.  Both isql and tsql connect and run happily, and
odbcinst -q -s shows me the expected DSNs.

Perl DBD crashes in src/tds/login.c line 339 (on CVS version from 8th)
calling connect.  All I have from the trace is:
Starting log file for FreeTDS 0.62.dev.20030608
        on 2003-06-10 09:37:40 with debug level 99.
names for ISO-8859-1: ISO-8859-1
names for UTF-8: UTF-8
names for UCS-2LE: UCS-2LE
names for UCS-2BE: UCS-2BE
iconv to convert client-side data to the "ISO-8859-1" character set
09:37:40.173098 tds_iconv_info_init: converting "ISO-8859-1"->"UCS-2LE"
09:37:40.173133 tds_iconv_info_init: converting "US-ASCII"->"US-ASCII"
09:37:40.173167 Connecting to port 1433, TDS 4.2.

I will add some trace to show the values used on the connect to find out
more of what the problem is.


----- Original Message -----
From: "Lowden, James K" <LowdenJK at bernstein.com>
To: "'TDS Development Group'" <freetds at lists.ibiblio.org>
Sent: Monday, June 09, 2003 6:37 PM
Subject: FW: [freetds] Compiling on FreeBSD without ICONV

> From: Alan Pettigrew [mailto:freetds at pettigrew.fsnet.co.uk]
> Sent: June 9, 2003 11:52 AM
> I had to add libraries libbind_r and libc_r
> before it would build, but it is now there.

I should have mentioned that the default is now multithreaded, too, which of
course is why you're pulling in the _r libraries.  Apparently FreeTDS can be
compiled for with multithreaded support for FreeBSD, which is good, but it
seems we are not automatically linking in all the required libraries, which
isn't.  :-(  I wonder how we should fix that.  Do you know?

For singlethreaded programs, we don't normally mention libc; it's included
among the linker's default libraries.  Is the usual practice for
multithreaded programs in FreeBSD to mention libc_r explicitly, or is there
some shortcut that says "do the multithreaded thing"?

Either way, it looks like we'll have to adjust configure.in to generate a
configure script that will work out of the box for FreeBSD.

Thanks for the pr, Alan.


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 we do not accept account orders and/or
instructions by e-mail, and therefore will not be responsible for carrying
out such orders and/or instructions.

FreeTDS mailing list
FreeTDS at lists.ibiblio.org

FreeTDS mailing list
FreeTDS at lists.ibiblio.org

More information about the FreeTDS mailing list