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

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Ryan Murphy <ryanfmurphy(at)gmail(dot)com>
Cc: Andres Freund <andres(at)anarazel(dot)de>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Patch: initdb: "'" for QUOTE_PATH (non-windows)
Date: 2016-08-18 03:15:56
Message-ID: CAB7nPqQMHbdgT_5S-3qdO4txmg4MFh9GesXnfAkLwjBumyOk1Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Aug 18, 2016 at 11:35 AM, Ryan Murphy <ryanfmurphy(at)gmail(dot)com> wrote:

Be careful of top-posting, this is not this ML style:
http://www.idallen.com/topposting.html

>> I think that's actually a good thing to forbid.
>
> I think I agree Andres, there are already comments in the appendShellString
> function to this effect - they say that CR/LF chars in a file name are
> mostly used for malicious hacking attempts anyways - I know I've hardly ever
> needed a newline in a file name.
>
> Did you see anything else in my code that you have recommendations about? I
> made sure to free the PQExpBufferStr vars that I allocated.

+ { /* pg_ctl command w path, properly quoted */
+ PQExpBuffer pg_ctl_path = createPQExpBuffer();
+ printfPQExpBuffer(pg_ctl_path, "%s%spg_ctl",
+ bin_dir,
+ (strlen(bin_dir) > 0) ? DIR_SEP : ""
+ );
+ appendShellString(start_db_cmd, pg_ctl_path->data);
+ destroyPQExpBuffer(pg_ctl_path);
+ }

This is not really project-style to have an independent block. Usually
those are controlled by for, while or if. And you could use the same
PQExpBuffer for everything.
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2016-08-18 03:18:33 Re: Patch: initdb: "'" for QUOTE_PATH (non-windows)
Previous Message Claudio Freire 2016-08-18 02:54:16 [WIP] [B-Tree] Keep indexes sorted by heap physical location