From owner-freebsd-questions@FreeBSD.ORG Mon Aug 28 21:33:06 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6CDD216A4DA for ; Mon, 28 Aug 2006 21:33:06 +0000 (UTC) (envelope-from dking@ketralnis.com) Received: from ketralnis.com (melchoir.ketralnis.com [68.183.67.83]) by mx1.FreeBSD.org (Postfix) with ESMTP id 10AAD43D46 for ; Mon, 28 Aug 2006 21:33:05 +0000 (GMT) (envelope-from dking@ketralnis.com) Received: from [192.168.1.27] (pix.xythos.com [64.154.218.194]) (authenticated bits=0) by ketralnis.com (8.13.6/8.13.6) with ESMTP id k7SLX41e008873 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NO) for ; Mon, 28 Aug 2006 14:33:05 -0700 (PDT) (envelope-from dking@ketralnis.com) Mime-Version: 1.0 (Apple Message framework v752.2) In-Reply-To: <20060828134729.U57414@betty.computinginnovations.com> References: <44F33207.2070401@nm.cbc.ca> <20060828134729.U57414@betty.computinginnovations.com> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Content-Transfer-Encoding: 7bit From: David King Date: Mon, 28 Aug 2006 14:32:48 -0700 To: freebsd-questions@freebsd.org X-Mailer: Apple Mail (2.752.2) Subject: Re: FreeBSD 5.4: 'cp -p' does not behave as documented X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Aug 2006 21:33:06 -0000 >> According to the cp man page: >> -p Cause cp to preserve the following attributes of each source file >> in the copy: modification time, access time, file flags, file >> mode, >> user ID, and group ID, as allowed by permissions. >> >> If the user ID and group ID cannot be preserved, no error message >> is displayed and the exit value is not altered. >> However, when I run this script or when I do a cp -p manually I am >> seeing: >> cp: chown: /stats/maillogs/maillog-copy-test.bz2: Permission denied > You need to run this as root so the permissions and ownership all > can be set. > -Derek I think you misunderstand the poster's complaint. It's not that the permissions aren't being set, it's that the documentation is incorrect. This part: If the user ID and group ID cannot be preserved, no error message is displayed and the exit value is not altered. is not in accordance to the behaviour that they are seeing. The owner and/or group could not be set, but cp(1) fails, and displays a message, but the documentation says that it should not display an error message or fail.