From owner-freebsd-bugs Mon Feb 12 7:30: 9 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 8E5E037B491 for ; Mon, 12 Feb 2001 07:30:07 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f1CFU7M87728; Mon, 12 Feb 2001 07:30:07 -0800 (PST) (envelope-from gnats) Date: Mon, 12 Feb 2001 07:30:07 -0800 (PST) Message-Id: <200102121530.f1CFU7M87728@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Garrett Wollman Subject: bin/25015: cp: options -i and -f do not work as documented Reply-To: Garrett Wollman Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org The following reply was made to PR bin/25015; it has been noted by GNATS. From: Garrett Wollman To: mkamm@gmx.net Cc: FreeBSD-gnats-submit@FreeBSD.ORG Subject: bin/25015: cp: options -i and -f do not work as documented Date: Mon, 12 Feb 2001 10:23:25 -0500 (EST) < Option -f is supposed to unlink targets before the copy takes > place. (This makes a great difference with respect to permissions and > especially with targets that are neither plain files nor directories.) Actually, no. The POSIX 1003.1-200x draft states: a. If dest_file exists, the following steps shall be taken: i. If the -i option is in effect, the cp utility shall write a prompt to the standard error and read a line from the standard input. If the response is not affirmative, cp shall do nothing more with source_file and go on to any remaining files. ii. A file descriptor for dest_file shall be obtained by performing actions equivalent to the open( ) function defined in the System Interfaces volume of IEEE Std 1003.1-200x called using dest_file as the path argument, and the bitwise-inclusive OR of O_WRONLY and O_TRUNC as the oflag argument. It goes on to say that if and only if (ii) fails, cp shall unlink the destination file and try again. Hmmm. If dest_file is a dangling symbolic link, does it exist or not? It's not obvious to me; I'll file an Aardvark against the specification. -GAWollman To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message