Re: psqlODBC and IPv6 - Mailing list pgsql-odbc

From Tom Lane
Subject Re: psqlODBC and IPv6
Date
Msg-id 27301.1221568555@sss.pgh.pa.us
Whole thread Raw
In response to Re: psqlODBC and IPv6  (Zoltan Boszormenyi <zb@cybertec.at>)
List pgsql-odbc
Zoltan Boszormenyi <zb@cybertec.at> writes:
> I just tested 08.03.0100 compiled with the difference quoted
> in my original mail. That single change made it work reliably
> over IPv6. It must be a very subtle side-effect of that typo.

Huh ... the IPv6 interaction is still obscure, but the .0100 code is
indubitably broken here.  Now that I look at it, there isn't any local
or global variable named "socket" in this function.  The compiler must
have interpreted "socket" as being the address of the socket()
function! ... so who knows what that comes out as being?  Proof is
found by noting the warning on that line:

[psqlodbc-08.03.0100]$ make socket.o
gcc -DHAVE_CONFIG_H -I.   -I/usr/include -I/home/tgl/testversion/include  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2
-fexceptions-fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c socket.c 
socket.c:178: warning: initialization from incompatible pointer type
socket.c: In function 'format_sockerr':
socket.c:198: warning: cast to pointer from integer of different size
socket.c: In function 'SOCK_wait_for_ready':
socket.c:475: warning: cast from pointer to integer of different size
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
socket.c:455: warning: 'no_timeout' may be used uninitialized in this function

I guess one possible theory is that SOCK_wait_for_ready() is simply
broken in .0100, but the kernel happens not to return EWOULDBLOCK
for local IPv4 connections whereas it sometimes does for IPv6?

BTW, isn't anyone paying attention to compiler warnings in this code base?
It looks to me like at least two of the three other warnings in this
file are also evidence of genuine bugs.  A look through the build log
shows an uncomfortably large number of nontrivial-looking warnings in
other files, too.

            regards, tom lane

pgsql-odbc by date:

Previous
From: Zoltan Boszormenyi
Date:
Subject: Re: psqlODBC and IPv6
Next
From: Tom Lane
Date:
Subject: Compiler warnings in psqloodbc 08.03.0200