Thread: Re: pgsql: Remove unsafe calling of WSAStartup and WSA Cleanup from DllMain.

Should this really be backpatched? It'll break existing apps that rely on libpq to call wsastartup for them.

/D

> ------- Original Message -------
> From: mha@postgresql.org(MagnusHagander)
> To: pgsql-committers@postgresql.org
> Sent: 08/03/07, 19:27:49
> Subject: [COMMITTERS] pgsql: Remove unsafe calling of WSAStartup and WSACleanup from DllMain.
>
> Log Message:
> -----------
> Remove unsafe calling of WSAStartup and WSACleanup from DllMain. Move the
> inline cleanup call around so it will be called in the right order, and
> be called on errors.
>
> Per report from Tokuharu Yuzawa.
>
> Tags:
> ----
> REL8_2_STABLE
>
> Modified Files:
> --------------
>     pgsql/src/interfaces/libpq:
>         bcc32.mak (r1.25.2.1 -> r1.25.2.2)
>
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/interfaces/libpq/bcc32.mak.diff?r1=1.25.2.1&r2=1.25.2.2)
>         fe-connect.c (r1.339 -> r1.339.2.1)
>
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/interfaces/libpq/fe-connect.c.diff?r1=1.339&r2=1.339.2.1)
>         win32.mak (r1.42.2.1 -> r1.42.2.2)
>
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/interfaces/libpq/win32.mak.diff?r1=1.42.2.1&r2=1.42.2.2)
>
> Removed Files:
> -------------
>     pgsql/src/interfaces/libpq:
>         libpqdll.c
>         (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/interfaces/libpq/libpqdll.c)
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings
>

Re: pgsql: Remove unsafe calling of WSAStartup and WSA Cleanup from DllMain.

From
Magnus Hagander
Date:
No, it shouldn't.

First, when on mingw, the file with WSAStartup() in it wasn't even
linked in. And this is the DLL that we've been distributing in the MSI.

Second, they really shouldn't rely on that anyway - I don't think we've
documented anywhere that libpq does this ;-) Because I assume you are
referring to applications that use *other* winsock functions, but don't
call WSAStartup() themselves? Because libpq still calls wsastartup on
the first attempt to open a connection.

//Magnus


Dave Page wrote:
> Should this really be backpatched? It'll break existing apps that rely on libpq to call wsastartup for them.
>
> /D
>
>> ------- Original Message -------
>> From: mha@postgresql.org(MagnusHagander)
>> To: pgsql-committers@postgresql.org
>> Sent: 08/03/07, 19:27:49
>> Subject: [COMMITTERS] pgsql: Remove unsafe calling of WSAStartup and WSACleanup from DllMain.
>>
>> Log Message:
>> -----------
>> Remove unsafe calling of WSAStartup and WSACleanup from DllMain. Move the
>> inline cleanup call around so it will be called in the right order, and
>> be called on errors.
>>
>> Per report from Tokuharu Yuzawa.
>>
>> Tags:
>> ----
>> REL8_2_STABLE
>>
>> Modified Files:
>> --------------
>>     pgsql/src/interfaces/libpq:
>>         bcc32.mak (r1.25.2.1 -> r1.25.2.2)
>>
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/interfaces/libpq/bcc32.mak.diff?r1=1.25.2.1&r2=1.25.2.2)
>>         fe-connect.c (r1.339 -> r1.339.2.1)
>>
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/interfaces/libpq/fe-connect.c.diff?r1=1.339&r2=1.339.2.1)
>>         win32.mak (r1.42.2.1 -> r1.42.2.2)
>>
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/interfaces/libpq/win32.mak.diff?r1=1.42.2.1&r2=1.42.2.2)
>>
>> Removed Files:
>> -------------
>>     pgsql/src/interfaces/libpq:
>>         libpqdll.c
>>         (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/interfaces/libpq/libpqdll.c)
>>
>> ---------------------------(end of broadcast)---------------------------
>> TIP 5: don't forget to increase your free space map settings
>>


Re: pgsql: Remove unsafe calling of WSAStartup and WSA Cleanup from DllMain.

From
Magnus Hagander
Date:
Magnus Hagander wrote:
> No, it shouldn't.

Eh, with that, I mean that it shouldn't break them, not that it
shouldn't be backpatched. I do think that it should be backpatched - but
if you can point me to a "real example" of something that does break,
I'll be happy to revert that part.

//Magnus

>
> First, when on mingw, the file with WSAStartup() in it wasn't even
> linked in. And this is the DLL that we've been distributing in the MSI.
>
> Second, they really shouldn't rely on that anyway - I don't think we've
> documented anywhere that libpq does this ;-) Because I assume you are
> referring to applications that use *other* winsock functions, but don't
> call WSAStartup() themselves? Because libpq still calls wsastartup on
> the first attempt to open a connection.
>
> //Magnus
>
>
> Dave Page wrote:
>> Should this really be backpatched? It'll break existing apps that rely on libpq to call wsastartup for them.
>>
>> /D
>>
>>> ------- Original Message -------
>>> From: mha@postgresql.org(MagnusHagander)
>>> To: pgsql-committers@postgresql.org
>>> Sent: 08/03/07, 19:27:49
>>> Subject: [COMMITTERS] pgsql: Remove unsafe calling of WSAStartup and WSACleanup from DllMain.
>>>
>>> Log Message:
>>> -----------
>>> Remove unsafe calling of WSAStartup and WSACleanup from DllMain. Move the
>>> inline cleanup call around so it will be called in the right order, and
>>> be called on errors.
>>>
>>> Per report from Tokuharu Yuzawa.
>>>
>>> Tags:
>>> ----
>>> REL8_2_STABLE
>>>
>>> Modified Files:
>>> --------------
>>>     pgsql/src/interfaces/libpq:
>>>         bcc32.mak (r1.25.2.1 -> r1.25.2.2)
>>>
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/interfaces/libpq/bcc32.mak.diff?r1=1.25.2.1&r2=1.25.2.2)
>>>         fe-connect.c (r1.339 -> r1.339.2.1)
>>>
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/interfaces/libpq/fe-connect.c.diff?r1=1.339&r2=1.339.2.1)
>>>         win32.mak (r1.42.2.1 -> r1.42.2.2)
>>>
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/interfaces/libpq/win32.mak.diff?r1=1.42.2.1&r2=1.42.2.2)
>>>
>>> Removed Files:
>>> -------------
>>>     pgsql/src/interfaces/libpq:
>>>         libpqdll.c
>>>         (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/interfaces/libpq/libpqdll.c)
>>>
>>> ---------------------------(end of broadcast)---------------------------
>>> TIP 5: don't forget to increase your free space map settings
>>>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend