From: Tom Lane <tgl@sss.pgh.pa.us>
To: John Rouillard <rouilj@renesys.com>
To: Tim <elatllat@gmail.com>
To: pgsql-admin@postgresql.org
Subject: Re: archive_command vs. cp -i
Date: Fri, 17 Jun 2011 19:17:56 -0400
Message-ID: <563.1308352676@sss.pgh.pa.us> (raw)
In-Reply-To: <20654.1308333896@sss.pgh.pa.us>
References: <20110617084057.238070@gmx.net>
<4DFB3B68020000250003E7EA@gw.wicourts.gov>
<BANLkTinjAm0nQ8Kosv7Q1u4=5UZj4jcFHQ@mail.gmail.com>
<20110617172650.GG26732@renesys.com>
<20654.1308333896@sss.pgh.pa.us>
I wrote:
> John Rouillard <rouilj@renesys.com> writes:
>> I get the same result (0 exit status) on solaris 8 and solaris 10 with
>> /bin/cp. I wonder what platform the example worked on.
> cp does behave as the example suggests for me, on OS X and HPUX. I
> suspect Bruce tested it on some BSD variant before putting it in the
> docs. That would suggest that it probably works that way on most (all?)
> BSDen. Still, if the GNU version doesn't act that way, we have a
> problem.
> The test-and-cp approach seems the most likely to be portable.
I've applied patches for this. It turns out that before 9.0, we did
have a warning that cp -i wasn't very trustworthy:
It is advisable to test your proposed archive command to ensure that it
indeed does not overwrite an existing file, <emphasis>and that it returns
nonzero status in this case</>. We have found that <literal>cp -i</> does
this correctly on some platforms but not others. If the chosen command
but somebody "improved" that text in a way that made it sound like you
could expect the command to work most places. On the whole it seems
like a better idea to provide a sample command that is safe most
everywhere, and then mention cp -i as a nonportable simplification.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: tgl@sss.pgh.pa.us, rouilj@renesys.com, elatllat@gmail.com
Subject: Re: archive_command vs. cp -i
In-Reply-To: <563.1308352676@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox