From: | Michael Paquier <michael(dot)paquier(at)gmail(dot)com> |
---|---|
To: | Christian Ullrich <chris(at)chrullrich(dot)net> |
Cc: | Andrew Dunstan <andrew(at)dunslane(dot)net>, Magnus Hagander <magnus(at)hagander(dot)net>, pgsql-committers <pgsql-committers(at)postgresql(dot)org>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: pgsql: Add putenv support for msvcrt from Visual Studio 2013 |
Date: | 2016-09-06 07:11:52 |
Message-ID: | CAB7nPqR5vDX4UBXGXqeUGQ5JUHpEg_1fQX7iiSHzNUVRCp-S0Q@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers pgsql-hackers |
On Thu, Sep 1, 2016 at 4:03 PM, Christian Ullrich <chris(at)chrullrich(dot)net> wrote:
> * Michael Paquier wrote:
>
>> On Wed, Apr 27, 2016 at 2:39 AM, Christian Ullrich <chris(at)chrullrich(dot)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.
Hm. OK.
> 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.
Yes. FWIW in my stuff everything gets compiled based on the same VS
version and bundled in the same msi, including a set of extensions
compiled from source, but perhaps my sight is too narrow in this
area... Well let's forget about that.
> 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?
Looking at the commit logs and 741e4ad7 that does not sound like a good idea.
+ if (!rtmodules[i].pinned)
+ {
+ HMODULE tmp;
+ BOOL res = GetModuleHandleEx(
+ GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS
+ | GET_MODULE_HANDLE_EX_FLAG_PIN,
+ (LPCTSTR)rtmodules[i].hmodule,
+ &tmp);
+ rtmodules[i].pinned = !!res;
+ }
It is better to avoid !!. See for example 1a7a436 that avoided
problems with VS2015 as far as I recall.
In order to avoid any problems with the load and unload windows, my
bet goes for 0001, 0002 and 0003, with the last two patches merged
together, 0001 being only a set of independent fixes. That's ugly, but
that looks the safest course of actions. I have rebased/rewritten the
patches as attached. Thoughts?
--
Michael
Attachment | Content-Type | Size |
---|---|---|
0001-Cleanups-in-pgwin32_putenv.patch | text/x-diff | 2.8 KB |
0002-Fix-the-load-race-in-pgwin32_putenv-and-open-the-unl.patch | text/x-diff | 1.6 KB |
0003-Pin-any-DLL-as-soon-as-seen-when-looking-for-_putenv.patch | text/x-diff | 2.9 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Christian Ullrich | 2016-09-06 08:36:45 | Re: pgsql: Add putenv support for msvcrt from Visual Studio 2013 |
Previous Message | Bruce Momjian | 2016-09-06 04:03:59 | pgsql: C comment: fix file name mention on line 1 |
From | Date | Subject | |
---|---|---|---|
Next Message | Ashutosh Bapat | 2016-09-06 07:13:39 | Re: Declarative partitioning - another take |
Previous Message | Heikki Linnakangas | 2016-09-06 07:08:52 | Re: Parallel tuplesort (for parallel B-Tree index creation) |