Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id B98AEB5DBCE for ; Fri, 17 Jun 2011 20:18:03 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 01870-05 for ; Fri, 17 Jun 2011 23:17:57 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 7BB9FB5DBC8 for ; Fri, 17 Jun 2011 20:17:57 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id p5HNHuOi000564; Fri, 17 Jun 2011 19:17:56 -0400 (EDT) To: John Rouillard , Tim , pgsql-admin@postgresql.org Subject: Re: archive_command vs. cp -i In-reply-to: <20654.1308333896@sss.pgh.pa.us> References: <20110617084057.238070@gmx.net> <4DFB3B68020000250003E7EA@gw.wicourts.gov> <20110617172650.GG26732@renesys.com> <20654.1308333896@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Fri, 17 Jun 2011 14:04:56 -0400" Date: Fri, 17 Jun 2011 19:17:56 -0400 Message-ID: <563.1308352676@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201106/112 X-Sequence-Number: 37738 I wrote: > John Rouillard 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, and that it returns nonzero status in this case. We have found that 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