pgsql: Clean up some code, comments and docs referring to Windows 2000

Started by Michael Paquierover 6 years ago5 messagescomitters
Jump to latest
#1Michael Paquier
michael@paquier.xyz

Clean up some code, comments and docs referring to Windows 2000 and older

This fixes and updates a couple of comments related to outdated Windows
versions. Particularly, src/common/exec.c had a fallback implementation
to read a file's line from a pipe because stdin/stdout/stderr does not
exist in Windows 2000 that is removed to simplify src/common/ as there
are unlikely versions of Postgres running on such platforms.

Author: Michael Paquier
Reviewed-by: Kyotaro Horiguchi, Juan José Santamaría Flecha
Discussion: /messages/by-id/20191219021526.GC4202@paquier.xyz

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/e2e02191e23379502a38a6b0436ab7f41b2efc08

Modified Files
--------------
doc/src/sgml/install-windows.sgml | 3 +-
doc/src/sgml/installation.sgml | 2 +-
src/backend/libpq/auth.c | 6 +-
src/bin/initdb/initdb.c | 11 ++--
src/common/exec.c | 132 +-------------------------------------
src/port/getaddrinfo.c | 12 +---
6 files changed, 13 insertions(+), 153 deletions(-)

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Michael Paquier (#1)
Re: pgsql: Clean up some code, comments and docs referring to Windows 2000

Michael Paquier <michael@paquier.xyz> writes:

Clean up some code, comments and docs referring to Windows 2000 and older

Surely this patch broke the error case in haveNativeWindowsIPv6routines()?
That is, in the admittedly unlikely case that LoadLibraryA("ws2_32")
succeeds but GetProcAddress(hLibrary, "getaddrinfo") doesn't, what you
now have will do FreeLibrary(hLibrary) and then proceed to use the
now-dangling hLibrary pointer anyway.

It looks to me like you should just remove this whole stanza now:

if (hLibrary == NULL || GetProcAddress(hLibrary, "getaddrinfo") == NULL)
{
/*
* Well, ws2_32 doesn't exist, or more likely doesn't have
* getaddrinfo.
*/
if (hLibrary != NULL)
FreeLibrary(hLibrary);
}

regards, tom lane

#3Michael Paquier
michael@paquier.xyz
In reply to: Tom Lane (#2)
Re: pgsql: Clean up some code, comments and docs referring to Windows 2000

On Wed, Feb 19, 2020 at 04:01:54PM -0500, Tom Lane wrote:

Surely this patch broke the error case in haveNativeWindowsIPv6routines()?
That is, in the admittedly unlikely case that LoadLibraryA("ws2_32")
succeeds but GetProcAddress(hLibrary, "getaddrinfo") doesn't, what you
now have will do FreeLibrary(hLibrary) and then proceed to use the
now-dangling hLibrary pointer anyway.

You are right, thanks! This block has no meaning anymore, so
removed.

For the note, it looks that we could get completely rid of
src/port/getaddrinfo.c once we drop support for XP as IPv6 support is
enabled by default on Vista and Windows 7. For XP, one needs to
install an extra module manually. Do you think that there are other
platforms using our port implementation for getaddrinfo() except
Windows? That's not material for today, obviously.
--
Michael

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Michael Paquier (#3)
Re: pgsql: Clean up some code, comments and docs referring to Windows 2000

Michael Paquier <michael@paquier.xyz> writes:

For the note, it looks that we could get completely rid of
src/port/getaddrinfo.c once we drop support for XP as IPv6 support is
enabled by default on Vista and Windows 7. For XP, one needs to
install an extra module manually. Do you think that there are other
platforms using our port implementation for getaddrinfo() except
Windows? That's not material for today, obviously.

We don't have to guess about it too much, we can check the buildfarm.
Of the configure-using animals, it looks like fairywren, gaur, and
jacana are using src/port/getaddrinfo.c. gaur's excuse is that its
libc is pre-IPv6 ;-) ... not sure about fairywren and jacana.

regards, tom lane

#5Michael Paquier
michael@paquier.xyz
In reply to: Tom Lane (#4)
Re: pgsql: Clean up some code, comments and docs referring to Windows 2000

On Thu, Feb 20, 2020 at 01:27:53AM -0500, Tom Lane wrote:

We don't have to guess about it too much, we can check the buildfarm.
Of the configure-using animals, it looks like fairywren, gaur, and
jacana are using src/port/getaddrinfo.c. gaur's excuse is that its
libc is pre-IPv6 ;-) ...

Oh, so that's an extra argument to keep the fallback implementation
for a longer time then. I did not notice that.

not sure about fairywren and jacana.

These two should actually be fine.
--
Michael