Quoting of *_command arguments

Started by Bruce Momjian5 months ago4 messagesdocs
Jump to latest
#1Bruce Momjian
bruce@momjian.us

We inconsistently double-quote the "%f" and "%p" arguments of
"archive_command" and "restore_command". Paths with spaces or special
characters, especially directory names in these cases, would need
double-quotes.

This patch adds double-quotes to all instances. I can also go the other
way and remove them all, but we should be consistent.

--
Bruce Momjian <bruce@momjian.us> https://momjian.us
EDB https://enterprisedb.com

Do not let urgent matters crowd out time for investment in the future.

Attachments:

command.difftext/x-diff; charset=us-asciiDownload+8-8
#2Peter Eisentraut
peter_e@gmx.net
In reply to: Bruce Momjian (#1)
Re: Quoting of *_command arguments

On 11.11.25 20:31, Bruce Momjian wrote:

We inconsistently double-quote the "%f" and "%p" arguments of
"archive_command" and "restore_command". Paths with spaces or special
characters, especially directory names in these cases, would need
double-quotes.

This patch adds double-quotes to all instances. I can also go the other
way and remove them all, but we should be consistent.

I think %f doesn't need to be quoted because it will only contain
certain characters, but if we tried to clarify that it would probably be
too confusing. It makes sense to nudge people that some quoting is prudent.

Your patch looks good to me.

#3Bruce Momjian
bruce@momjian.us
In reply to: Peter Eisentraut (#2)
Re: Quoting of *_command arguments

On Wed, Nov 12, 2025 at 02:45:16PM +0100, Peter Eisentraut wrote:

On 11.11.25 20:31, Bruce Momjian wrote:

We inconsistently double-quote the "%f" and "%p" arguments of
"archive_command" and "restore_command". Paths with spaces or special
characters, especially directory names in these cases, would need
double-quotes.

This patch adds double-quotes to all instances. I can also go the other
way and remove them all, but we should be consistent.

I think %f doesn't need to be quoted because it will only contain certain
characters, but if we tried to clarify that it would probably be too
confusing. It makes sense to nudge people that some quoting is prudent.

Yeah, I did consider your point but you are right --- it is too complex
to quote one and not the other and expect people to understand why.

Your patch looks good to me.

Thanks.

--
Bruce Momjian <bruce@momjian.us> https://momjian.us
EDB https://enterprisedb.com

Do not let urgent matters crowd out time for investment in the future.

#4Bruce Momjian
bruce@momjian.us
In reply to: Bruce Momjian (#3)
Re: Quoting of *_command arguments

On Wed, Nov 12, 2025 at 08:48:39AM -0500, Bruce Momjian wrote:

On Wed, Nov 12, 2025 at 02:45:16PM +0100, Peter Eisentraut wrote:

On 11.11.25 20:31, Bruce Momjian wrote:

We inconsistently double-quote the "%f" and "%p" arguments of
"archive_command" and "restore_command". Paths with spaces or special
characters, especially directory names in these cases, would need
double-quotes.

This patch adds double-quotes to all instances. I can also go the other
way and remove them all, but we should be consistent.

I think %f doesn't need to be quoted because it will only contain certain
characters, but if we tried to clarify that it would probably be too
confusing. It makes sense to nudge people that some quoting is prudent.

Yeah, I did consider your point but you are right --- it is too complex
to quote one and not the other and expect people to understand why.

Your patch looks good to me.

Thanks.

Applied, and I added double-quotes for "%r".

--
Bruce Momjian <bruce@momjian.us> https://momjian.us
EDB https://enterprisedb.com

Do not let urgent matters crowd out time for investment in the future.