Re: Patch: initdb: "'" for QUOTE_PATH (non-windows)

From: Ryan Murphy <ryanfmurphy(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Patch: initdb: "'" for QUOTE_PATH (non-windows)
Date: 2016-08-19 19:39:58
Message-ID: CAHeEsBe+fe5Yw=zb8aWSiwxwEiW95zTawmB0Rrvegv5qLhHFbg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Here is another version of my initdb shell quoting patch. I have removed
the unnecessary {} block. I also ran pgindent on the code prior to
creating the patch.

On Thu, Aug 18, 2016 at 3:50 PM, Ryan Murphy <ryanfmurphy(at)gmail(dot)com> wrote:

>
>
> On Thu, Aug 18, 2016 at 3:44 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
>> Ryan Murphy <ryanfmurphy(at)gmail(dot)com> writes:
>> > On Thu, Aug 18, 2016 at 3:22 PM, Robert Haas <robertmhaas(at)gmail(dot)com>
>> wrote:
>> >>>> + { /* pg_ctl command w path, properly quoted */
>> >>>> + PQExpBuffer pg_ctl_path = createPQExpBuffer();
>> >>>> + printfPQExpBuffer(pg_ctl_path, "%s%spg_ctl",
>>
>> >> I think it's worth reducing the scope of variables when that's as
>> >> simple as putting them inside a block that you have to create anyway,
>> >> but I'm skeptical about the idea that one would create a block just to
>> >> reduce the scope of the variables. I don't think that's our usual
>> >> practice, and I would expect the compiler to detect where the variable
>> >> is referenced first and last anyway.
>>
>> > I enjoy adding the blocks for explicit variable scoping and for quick
>> > navigation in vim (the % key navigates between matching {}'s). But I
>> want
>> > to fit in with the style conventions of the project.
>>
>> Another point here is that code like this will look quite a bit different
>> after pgindent gets done with it --- that comment will not stay where
>> you put it, for example. Some of our worst formatting messes come from
>> code wherein somebody adhered to their own favorite layout style without
>> any thought for how it would play with pgindent.
>>
>> regards, tom lane
>>
>
> Ahh, I didn't know about pgindent, but now I see it in /src/tools. I can
> run that on my code before submitting.
>
> I found these
> <https://www.postgresql.org/message-id/1221125165.5637.12.camel@abbas-laptop>
> links <https://www.postgresql.org/docs/devel/static/source-format.html>
> about the style convention and will make sure my patch fits the conventions
> before submitting it.
>
>

Attachment Content-Type Size
0001-initdb-quote-shell-args-in-final-pg_ctl-command.patch application/octet-stream 3.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2016-08-19 20:21:34 Re: Use %u to print user mapping's umid and userid
Previous Message Alvaro Herrera 2016-08-19 17:41:36 Re: errno clobbering in reorderbuffer