Thread: fix for windows breakage in regression script

fix for windows breakage in regression script

From
Andrew Dunstan
Date:
The recent change to pg_regress.sh has apparently broken testing on my
Windows machine - see
http://www.pgbuildfarm.org/cgi-bin/show_log.pl?nm=loris&dt=2005-01-15%2001:36:36
which contains this:

================== pgsql.2544/src/test/regress/log/postmaster.log ===================
LOG:  could not translate host name "''", service "65432" to address: Unknown host
WARNING:  could not create listen socket for "''"
FATAL:  no socket created for listening

The attached patch seems to cure the problem.



cheers

andrew
Index: src/test/regress/pg_regress.sh
===================================================================
RCS file: /home/cvsmirror/pgsql/src/test/regress/pg_regress.sh,v
retrieving revision 1.52
diff -c -r1.52 pg_regress.sh
*** src/test/regress/pg_regress.sh    12 Jan 2005 16:19:51 -0000    1.52
--- src/test/regress/pg_regress.sh    15 Jan 2005 03:31:27 -0000
***************
*** 196,202 ****
  # ----------

  case $host_platform in
!     *-*-qnx* | *beos*)
          unix_sockets=no;;
      *)
          unix_sockets=yes;;
--- 196,202 ----
  # ----------

  case $host_platform in
!     *-*-qnx* | *beos* | *-*-mingw32* )
          unix_sockets=no;;
      *)
          unix_sockets=yes;;

Re: fix for windows breakage in regression script

From
Tom Lane
Date:
Andrew Dunstan <andrew@dunslane.net> writes:
> The recent change to pg_regress.sh has apparently broken testing on my
> Windows machine - see
> http://www.pgbuildfarm.org/cgi-bin/show_log.pl?nm=loris&dt=2005-01-15%2001:36:36
> which contains this:

Y'know, I wondered why windows wasn't listed in that CASE.  I guess the
answer is it didn't have to be right before.

What about the Cygwin port --- will it have the same issue?  If so what
should we add?

            regards, tom lane

Re: fix for windows breakage in regression script

From
Andrew Dunstan
Date:

Tom Lane wrote:

>Andrew Dunstan <andrew@dunslane.net> writes:
>
>
>>The recent change to pg_regress.sh has apparently broken testing on my
>>Windows machine - see
>>http://www.pgbuildfarm.org/cgi-bin/show_log.pl?nm=loris&dt=2005-01-15%2001:36:36
>>which contains this:
>>
>>
>
>Y'know, I wondered why windows wasn't listed in that CASE.  I guess the
>answer is it didn't have to be right before.
>
>What about the Cygwin port --- will it have the same issue?  If so what
>should we add?
>
>
>
>

No, Cygwin works OK - still have occasional issues with non-empty
tablespaces, but not this issue. The Cygwin environment itself emulates
unix sockets, I think that's the reason.

cheers

andrew

Re: fix for windows breakage in regression script

From
Tom Lane
Date:
Andrew Dunstan <andrew@dunslane.net> writes:
> Tom Lane wrote:
>> What about the Cygwin port --- will it have the same issue?  If so what
>> should we add?

> No, Cygwin works OK - still have occasional issues with non-empty
> tablespaces, but not this issue. The Cygwin environment itself emulates
> unix sockets, I think that's the reason.

Hm --- have you checked it since I changed the script?

port/cygwin.h claims that older versions of Cygwin don't have Unix
sockets, and there's a hack in pg_config_manual.h that sure looks like
it will disable HAVE_UNIX_SOCKETS on any Cygwin version.  I'm inclined
to think that pg_regress should play it safe and assume no Unix sockets
on Cygwin.

            regards, tom lane

Re: fix for windows breakage in regression script

From
Andrew Dunstan
Date:

Tom Lane wrote:

>Andrew Dunstan <andrew@dunslane.net> writes:
>
>
>>Tom Lane wrote:
>>
>>
>>>What about the Cygwin port --- will it have the same issue?  If so what
>>>should we add?
>>>
>>>
>
>
>
>>No, Cygwin works OK - still have occasional issues with non-empty
>>tablespaces, but not this issue. The Cygwin environment itself emulates
>>unix sockets, I think that's the reason.
>>
>>
>
>Hm --- have you checked it since I changed the script?
>
>

yes. See
http://www.pgbuildfarm.org/cgi-bin/show_history.pl?nm=gibbon&br=HEAD

>port/cygwin.h claims that older versions of Cygwin don't have Unix
>sockets, and there's a hack in pg_config_manual.h that sure looks like
>it will disable HAVE_UNIX_SOCKETS on any Cygwin version.  I'm inclined
>to think that pg_regress should play it safe and assume no Unix sockets
>on Cygwin.
>
>
>
>


Mine is fairly up to date - fairly sure I ran an update in the last
month or so, and it was only installed 6 months ago anyway.

I have no idea how far back you would have to go to be missing unix
sockets. Several years I suspect.

cheers

andrew

Re: fix for windows breakage in regression script

From
Tom Lane
Date:
Andrew Dunstan <andrew@dunslane.net> writes:
> Tom Lane wrote:
>> Hm --- have you checked it since I changed the script?

> yes. See
> http://www.pgbuildfarm.org/cgi-bin/show_history.pl?nm=gibbon&br=HEAD

[ scratches head... ]  Why isn't the #undef in pg_config_manual.h firing
on Cygwin?

            regards, tom lane

Re: fix for windows breakage in regression script

From
"Andrew Dunstan"
Date:
Tom Lane said:
> Andrew Dunstan <andrew@dunslane.net> writes:
>> Tom Lane wrote:
>>> Hm --- have you checked it since I changed the script?
>
>> yes. See
>> http://www.pgbuildfarm.org/cgi-bin/show_history.pl?nm=gibbon&br=HEAD
>
> [ scratches head... ]  Why isn't the #undef in pg_config_manual.h
> firing on Cygwin?

The lines say:

#if defined(__QNX__) || defined(__BEOS__) || defined(WIN32)
#undef HAVE_UNIX_SOCKETS
#endif

But on Cygwin, WIN32 is only defined if windows.h has been included (See
previous discussion - I recall advocating NOT using WIN32 as a marker for
just this reason).


cheers

andrew



Re: fix for windows breakage in regression script

From
Tom Lane
Date:
"Andrew Dunstan" <andrew@dunslane.net> writes:
> Tom Lane said:
>> [ scratches head... ]  Why isn't the #undef in pg_config_manual.h
>> firing on Cygwin?

> But on Cygwin, WIN32 is only defined if windows.h has been included (See
> previous discussion - I recall advocating NOT using WIN32 as a marker for
> just this reason).

Urgh ... so it's only because windows.h isn't included till later that
it works properly.

I'm not sure that we need the code in pg_config_manual.h anymore anyway
--- the configure test should be covering this.  But just before release
is no time to be fooling with such things.

I did add cygwin to the unix_socket=no case in pg_regress, and I'm
inclined to leave it that way because it's really the minimal change
from the script's previous behavior on cygwin.  Do you see a strong
reason for undoing that?

            regards, tom lane

Re: fix for windows breakage in regression script

From
Andrew Dunstan
Date:

Tom Lane wrote:

>"Andrew Dunstan" <andrew@dunslane.net> writes:
>
>
>>Tom Lane said:
>>
>>
>>>[ scratches head... ]  Why isn't the #undef in pg_config_manual.h
>>>firing on Cygwin?
>>>
>>>
>
>
>
>>But on Cygwin, WIN32 is only defined if windows.h has been included (See
>>previous discussion - I recall advocating NOT using WIN32 as a marker for
>>just this reason).
>>
>>
>
>Urgh ... so it's only because windows.h isn't included till later that
>it works properly.
>
>

It's a lot more subtle than that :-( .  In most cases we end up
including windows.h _only_ if WIN32 is already defined, as it is for us
by the compiler on MinGW.

see: http://archives.postgresql.org/pgsql-hackers/2004-09/msg00206.php
and http://archives.postgresql.org/pgsql-hackers/2004-09/msg00256.php

w.r.t. Cygwin / unix sockets, the test is in port/cygwin.h, and says:

#if CYGWIN_VERSION_DLL_MAJOR < 1001
#undef HAVE_UNIX_SOCKETS
#endif

I don't know how old that is.

>I'm not sure that we need the code in pg_config_manual.h anymore anyway
>--- the configure test should be covering this.  But just before release
>is no time to be fooling with such things.
>
>

agreed.

>I did add cygwin to the unix_socket=no case in pg_regress, and I'm
>inclined to leave it that way because it's really the minimal change
>from the script's previous behavior on cygwin.  Do you see a strong
>reason for undoing that?
>
>
>
>

Well, nothing seems broken - see buildfarm. And if it ain't broke .../

cheers

andrew
/

Re: fix for windows breakage in regression script

From
Reini Urban
Date:
Andrew Dunstan schrieb:
> Tom Lane wrote:
>> "Andrew Dunstan" <andrew@dunslane.net> writes:
>>> Tom Lane said:
>>>> [ scratches head... ]  Why isn't the #undef in pg_config_manual.h
>>>> firing on Cygwin?
>>
>>> But on Cygwin, WIN32 is only defined if windows.h has been included (See
>>> previous discussion - I recall advocating NOT using WIN32 as a marker
>>> for
>>> just this reason).
>>
>> Urgh ... so it's only because windows.h isn't included till later that
>> it works properly.
>
> It's a lot more subtle than that :-( .  In most cases we end up
> including windows.h _only_ if WIN32 is already defined, as it is for us
> by the compiler on MinGW.
>
> see: http://archives.postgresql.org/pgsql-hackers/2004-09/msg00206.php
> and http://archives.postgresql.org/pgsql-hackers/2004-09/msg00256.php
>
> w.r.t. Cygwin / unix sockets, the test is in port/cygwin.h, and says:
>
> #if CYGWIN_VERSION_DLL_MAJOR < 1001
> #undef HAVE_UNIX_SOCKETS
> #endif
>
> I don't know how old that is.

This is a perfectly good logic.

>> I'm not sure that we need the code in pg_config_manual.h anymore anyway
>> --- the configure test should be covering this.  But just before release
>> is no time to be fooling with such things.

> agreed.
>
>> I did add cygwin to the unix_socket=no case in pg_regress, and I'm
>> inclined to leave it that way because it's really the minimal change
>> from the script's previous behavior on cygwin.  Do you see a strong
>> reason for undoing that?
>>
> Well, nothing seems broken - see buildfarm. And if it ain't broke .../

Without sockets it's just a bit slower. Otherwise I don't care.
It should work on Cygwin with and without.
--
Reini Urban
http://xarch.tu-graz.ac.at/home/rurban/