Re: Re: [COMMITTERS] pgsql: Don't use "cp -i" in the example WAL archive_command.

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Thom Brown <thom(at)linux(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Re: [COMMITTERS] pgsql: Don't use "cp -i" in the example WAL archive_command.
Date: 2011-06-18 13:28:48
Message-ID: 201106181328.p5IDSmR18887@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Tom Lane wrote:
> Thom Brown <thom(at)linux(dot)com> writes:
> > On 18 June 2011 04:13, Bruce Momjian <bruce(at)momjian(dot)us> wrote:
> >> I tested on FreeBSD 7.4 and saw a 1 error return:
>
> > And on a Mac (so through Darwin 10.7.0 a BSD version too):
>
> Yeah, see yesterday's discussion on pgsql-admin. I think the behavior
> with the error return may be a BSD-ism. In any case, GNU cp does *not*
> do what we want, and that accounts for a sufficiently large fraction of
> machines in the field that I think it's just unsafe to suggest using
> "cp -i" so prominently. There are too many people who'll just copy and
> paste the first example provided, especially if the warning to test it
> is buried several paragraphs later.

Agreed. Even if we could decide whether we want an existing file to
cause cp to fail or succeed, the bigger problem is that 'test ! -f $FILE
&& cp' and 'cp -i' often don't do the same thing, to the point where it
doesn't even seem worth mentioning the idea of using 'cp -i' at all.

I frankly don't think most users are competent enough to be able to test
their cp -i command, end even if they are, that script might migrate to
a machine that handles cp -i differently.

I think we should just document the test ! -f version and be done with
it, and maybe mention cp -i as non-portable.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ It's impossible for everything to be true. +

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Andrew Dunstan 2011-06-18 13:39:32 Re: Re: [COMMITTERS] pgsql: Don't use "cp -i" in the example WAL archive_command.
Previous Message Tom Lane 2011-06-18 13:19:54 Re: Re: [COMMITTERS] pgsql: Don't use "cp -i" in the example WAL archive_command.

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2011-06-18 13:34:58 Re: pg_upgrade using appname to lock out other users
Previous Message Pavel Stehule 2011-06-18 13:21:39 plpgsql performance - SearchCatCache issue