Re: Removing service-related code in pg_ctl for Cygwin

Lists: pgsql-hackers
From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, marco(dot)atzeri(at)gmail(dot)com
Subject: Removing service-related code in pg_ctl for Cygwin
Date: 2016-01-14 05:38:35
Message-ID: CAB7nPqTM1s=HhGu1wZd9zmGSbgQqNJiiU+q8sp+qpR2c2qY2PA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi all,

Beginning a new thread seems more adapted regarding $subject but
that's mentioned here as well:
http://www.postgresql.org/message-id/CAB7nPqQXghm_SdB5iniupz1atzMxk=95gv9A8ocdo83SXCNjeg@mail.gmail.com

It happens based on some investigation from Andrew that cygwin does
not need to use the service-related code, aka register/unregister
options or similar that are proper to WIN32 and rely instead on
cygrunsrv with a SYSV-like init file to manage the service. Based on
my tests with cygwin, I am able to see as well that a server started
within a cygwin session is able to persist even after it is closed,
which is kind of nice and I think that it is a additional reason to
not use the service-related code paths. Hence what about the following
patch, that makes cygwin behave like any *nix OS when using pg_ctl?
This simplifies a bit the code.

Marco, as I think you do some packaging for Postgres in Cygwin, and
others, does that sound acceptable?

Regards,
--
Michael

Attachment Content-Type Size
cygwin-removal-service-master.patch binary/octet-stream 4.8 KB

From: Marco Atzeri <marco(dot)atzeri(at)gmail(dot)com>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>
Subject: Re: Removing service-related code in pg_ctl for Cygwin
Date: 2016-01-14 11:01:48
Message-ID: 5697801C.1050101@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 14/01/2016 06:38, Michael Paquier wrote:
> Hi all,
>
> Beginning a new thread seems more adapted regarding $subject but
> that's mentioned here as well:
> http://www.postgresql.org/message-id/CAB7nPqQXghm_SdB5iniupz1atzMxk=95gv9A8ocdo83SXCNjeg@mail.gmail.com
>
> It happens based on some investigation from Andrew that cygwin does
> not need to use the service-related code, aka register/unregister
> options or similar that are proper to WIN32 and rely instead on
> cygrunsrv with a SYSV-like init file to manage the service. Based on
> my tests with cygwin, I am able to see as well that a server started
> within a cygwin session is able to persist even after it is closed,
> which is kind of nice and I think that it is a additional reason to
> not use the service-related code paths. Hence what about the following
> patch, that makes cygwin behave like any *nix OS when using pg_ctl?
> This simplifies a bit the code.
>
> Marco, as I think you do some packaging for Postgres in Cygwin, and
> others, does that sound acceptable?
>
> Regards,
>

In general cygwin to behave like any *nix OS is the preferred solution.


From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Cc: marco(dot)atzeri(at)gmail(dot)com
Subject: Re: Removing service-related code in pg_ctl for Cygwin
Date: 2016-01-18 17:32:27
Message-ID: 569D21AB.7000508@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 01/14/2016 12:38 AM, Michael Paquier wrote:
> Hi all,
>
> Beginning a new thread seems more adapted regarding $subject but
> that's mentioned here as well:
> http://www.postgresql.org/message-id/CAB7nPqQXghm_SdB5iniupz1atzMxk=95gv9A8ocdo83SXCNjeg@mail.gmail.com
>
> It happens based on some investigation from Andrew that cygwin does
> not need to use the service-related code, aka register/unregister
> options or similar that are proper to WIN32 and rely instead on
> cygrunsrv with a SYSV-like init file to manage the service. Based on
> my tests with cygwin, I am able to see as well that a server started
> within a cygwin session is able to persist even after it is closed,
> which is kind of nice and I think that it is a additional reason to
> not use the service-related code paths. Hence what about the following
> patch, that makes cygwin behave like any *nix OS when using pg_ctl?
> This simplifies a bit the code.
>
> Marco, as I think you do some packaging for Postgres in Cygwin, and
> others, does that sound acceptable?
>

I think we can be a bit more adventurous and remove all the
Cygwin-specific code. See attached patch, which builds fine on buildfarm
cockatiel.

cheers

andrew

Attachment Content-Type Size
cygwin-removal-service-master-2.patch text/x-diff 6.3 KB

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>, marco(dot)atzeri(at)gmail(dot)com
Subject: Re: Removing service-related code in pg_ctl for Cygwin
Date: 2016-01-18 17:38:05
Message-ID: 20160118173805.GA90288@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Andrew Dunstan wrote:

> I think we can be a bit more adventurous and remove all the Cygwin-specific
> code. See attached patch, which builds fine on buildfarm cockatiel.

Hopefully you also tested that it builds under MSVC :-)

--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>, marco(dot)atzeri(at)gmail(dot)com
Subject: Re: Removing service-related code in pg_ctl for Cygwin
Date: 2016-01-18 20:19:02
Message-ID: 569D48B6.3050409@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 01/18/2016 12:38 PM, Alvaro Herrera wrote:
> Andrew Dunstan wrote:
>
>> I think we can be a bit more adventurous and remove all the Cygwin-specific
>> code. See attached patch, which builds fine on buildfarm cockatiel.
> Hopefully you also tested that it builds under MSVC :-)
>

Why would I? This isn't having the slightest effect on MSVC builds.

cheers

andrew


From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>, marco(dot)atzeri(at)gmail(dot)com
Subject: Re: Removing service-related code in pg_ctl for Cygwin
Date: 2016-01-18 20:46:45
Message-ID: 20160118204645.GA128796@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Andrew Dunstan wrote:
>
>
> On 01/18/2016 12:38 PM, Alvaro Herrera wrote:
> >Andrew Dunstan wrote:
> >
> >>I think we can be a bit more adventurous and remove all the Cygwin-specific
> >>code. See attached patch, which builds fine on buildfarm cockatiel.
> >Hopefully you also tested that it builds under MSVC :-)
>
> Why would I? This isn't having the slightest effect on MSVC builds.

You never know ... you might have inadvertently broken some WIN32 block.

--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>, marco(dot)atzeri(at)gmail(dot)com
Subject: Re: Removing service-related code in pg_ctl for Cygwin
Date: 2016-01-18 21:27:11
Message-ID: 569D58AF.4000303@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 01/18/2016 03:46 PM, Alvaro Herrera wrote:
> Andrew Dunstan wrote:
>>
>> On 01/18/2016 12:38 PM, Alvaro Herrera wrote:
>>> Andrew Dunstan wrote:
>>>
>>>> I think we can be a bit more adventurous and remove all the Cygwin-specific
>>>> code. See attached patch, which builds fine on buildfarm cockatiel.
>>> Hopefully you also tested that it builds under MSVC :-)
>> Why would I? This isn't having the slightest effect on MSVC builds.
> You never know ... you might have inadvertently broken some WIN32 block.
>

If you can point out a line where that might be true I'll test it ;-)

cheers

andrew


From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>, marco(dot)atzeri(at)gmail(dot)com
Subject: Re: Removing service-related code in pg_ctl for Cygwin
Date: 2016-01-19 05:11:20
Message-ID: CAB7nPqSKOa5uT=p2vDjkV_GTAWLD=Gr7wEC0YjE+T5w-TzB-Gg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, Jan 19, 2016 at 2:32 AM, Andrew Dunstan <andrew(at)dunslane(dot)net> wrote:
>
>
> On 01/14/2016 12:38 AM, Michael Paquier wrote:
>>
>> Hi all,
>>
>> Beginning a new thread seems more adapted regarding $subject but
>> that's mentioned here as well:
>>
>> http://www.postgresql.org/message-id/CAB7nPqQXghm_SdB5iniupz1atzMxk=95gv9A8ocdo83SXCNjeg@mail.gmail.com
>>
>> It happens based on some investigation from Andrew that cygwin does
>> not need to use the service-related code, aka register/unregister
>> options or similar that are proper to WIN32 and rely instead on
>> cygrunsrv with a SYSV-like init file to manage the service. Based on
>> my tests with cygwin, I am able to see as well that a server started
>> within a cygwin session is able to persist even after it is closed,
>> which is kind of nice and I think that it is a additional reason to
>> not use the service-related code paths. Hence what about the following
>> patch, that makes cygwin behave like any *nix OS when using pg_ctl?
>> This simplifies a bit the code.
>>
>> Marco, as I think you do some packaging for Postgres in Cygwin, and
>> others, does that sound acceptable?
>>
>
>
>
> I think we can be a bit more adventurous and remove all the Cygwin-specific
> code. See attached patch, which builds fine on buildfarm cockatiel.

Ah, OK. I see the difference. It builds as well for me.

-#ifndef __CYGWIN__
- AddUserToTokenDacl(restrictedToken);
-#endif
[...]
-#if defined(WIN32) || defined(__CYGWIN__)
+#ifdef WIN32
setvbuf(stderr, NULL, _IONBF, 0);
#endif
Fine for me, those two do not seem to matter much as far as I have tested.
--
Michael


From: Marco Atzeri <marco(dot)atzeri(at)gmail(dot)com>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Removing service-related code in pg_ctl for Cygwin
Date: 2016-01-19 08:45:08
Message-ID: 569DF794.8070500@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 18/01/2016 18:32, Andrew Dunstan wrote:
>
>
> On 01/14/2016 12:38 AM, Michael Paquier wrote:
>> Hi all,
>>
>> Beginning a new thread seems more adapted regarding $subject but
>> that's mentioned here as well:
>> http://www.postgresql.org/message-id/CAB7nPqQXghm_SdB5iniupz1atzMxk=95gv9A8ocdo83SXCNjeg@mail.gmail.com
>>
>>

>>
>> Marco, as I think you do some packaging for Postgres in Cygwin, and
>> others, does that sound acceptable?
>>
>
>
>
> I think we can be a bit more adventurous and remove all the
> Cygwin-specific code. See attached patch, which builds fine on buildfarm
> cockatiel.
>
> cheers
>
> andrew
>

builds fine also here on 64bit