From: Christian Ullrich <chris@chrullrich.net>
To: Michael Paquier <michael.paquier@gmail.com>
Cc: Andrew Dunstan <andrew@dunslane.net>
Cc: Magnus Hagander <magnus@hagander.net>
Cc: pgsql-committers <pgsql-committers@postgresql.org>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: Re: pgsql: Add putenv support for msvcrt from Visual Studio 2013
Date: Thu, 1 Sep 2016 09:03:15 +0200
Message-ID: <74d35d99-8816-f58f-5898-338fb290567e@chrullrich.net> (raw)
In-Reply-To: <CAB7nPqQyNvox10vK1xPvHVsy9NTKJtdbOOHYzLcJiM1DzFtoLg@mail.gmail.com>
References: <E1atXIK-0003un-G0@gemulon.postgresql.org>
<b0c66170-5711-20dd-2de3-408429ca0f48@chrullrich.net>
<CABUevEzicpYAUOF9ZHkee1-c-gvokKAmr708sqta4H71bOZOWQ@mail.gmail.com>
<34dd7956-3324-0305-288d-edc7d56fba76@chrullrich.net>
<571E6D90.7050903@dunslane.net>
<9d5c6a49-774c-44de-83fc-65c5b431f8d9@chrullrich.net>
<2c5f9472-d0cc-df61-78e3-bc48909ffb59@chrullrich.net>
<784524b2-bd50-1f5e-dad9-f8840f97753a@chrullrich.net>
<CAB7nPqQyNvox10vK1xPvHVsy9NTKJtdbOOHYzLcJiM1DzFtoLg@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>
* Michael Paquier wrote:
> On Wed, Apr 27, 2016 at 2:39 AM, Christian Ullrich
<chris@chrullrich.net> wrote:
>> * Christian Ullrich wrote:
> And actually, by looking at those patches, isn't it a dangerous
> practice to be able to load multiple versions of the same DLL routines
> in the same workspace? I have personally very bad souvenirs with that,
No, it is exactly what the version-specific CRTs are meant to allow.
Each module uses the CRT version it needs, and they don't share any
state, so absent bugs, they cannot conflict.
Of the processes currently running on my system, 25 have more than one
CRT loaded (one has three, the others two).
> and particularly loading multiple versions of msvcr into the same
> workspace can cause unwanted crashes and corruptions of processes. In
> short I mean this thing: https://en.wikipedia.org/wiki/DLL_Hell.
That was about DLLs existing in different versions with the same file
name, and installers replacing them with their own, leading to problems
with other applications that expected to load their preferred version.
This does not apply to the multiple-CRT situation, because all minor
versions of a given CRT are supposed to be ABI compatible.
> So, shouldn't we first make the DLL list a little bit more severe
> depending on the value of _MSC_VER? I would mean something like that:
> #ifdef _MSC_VER >= 1900
> {"ucrtbase", NULL, NULL},
> #elif _MSC_VER >= 1800
> {"msvcr120", NULL, NULL},
> #elif etc, etc.
> [...]
> #endif
>
> This would require modules to be built using the same msvc version as
> the core server, but that's better than just plain crash if loaded
> DLLs corrupt the stack. Am I missing something?
Yes: This turns (this part of) pgwin32_putenv() into a great big NOP. We
call putenv() anyway on the very last line of the function, so if we
require common-CRT builds, that call alone (together with the
SetEnvironmentVariable() just above) is sufficient.
That said, introducing this requirement would be a very significant
change. I'm not sure how many independently maintained compiled
extensions there are, but this would mean that their developers would
have to have the matching VS versions for every PG distribution they
want to support. Even if that's just EDB, it still is a lot of effort.
My conclusion from April stands:
> The fact that master looks like it does means that there have not been
> many (or any) complaints about missing cross-module environment
> variables. If nobody ever needs to see a variable set elsewhere, we
> have a very simple solution: Why don't we simply throw out the whole
> #ifdef _MSC_VER block?
--
Christian
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: chris@chrullrich.net, michael.paquier@gmail.com, andrew@dunslane.net, magnus@hagander.net, pgsql-hackers@postgresql.org
Subject: Re: pgsql: Add putenv support for msvcrt from Visual Studio 2013
In-Reply-To: <74d35d99-8816-f58f-5898-338fb290567e@chrullrich.net>
References: <E1atXIK-0003un-G0@gemulon.postgresql.org> <b0c66170-5711-20dd-2de3-408429ca0f48@chrullrich.net> <CABUevEzicpYAUOF9ZHkee1-c-gvokKAmr708sqta4H71bOZOWQ@mail.gmail.com> <34dd7956-3324-0305-288d-edc7d56fba76@chrullrich.net> <571E6D90.7050903@dunslane.net> <9d5c6a49-774c-44de-83fc-65c5b431f8d9@chrullrich.net> <2c5f9472-d0cc-df61-78e3-bc48909ffb59@chrullrich.net> <784524b2-bd50-1f5e-dad9-f8840f97753a@chrullrich.net> <CAB7nPqQyNvox10vK1xPvHVsy9NTKJtdbOOHYzLcJiM1DzFtoLg@mail.gmail.com> <74d35d99-8816-f58f-5898-338fb290567e@chrullrich.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox