Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Feb 2001 07:30:07 -0800 (PST)
From:      Garrett Wollman <wollman@khavrinen.lcs.mit.edu>
To:        freebsd-bugs@FreeBSD.org
Subject:   bin/25015: cp: options -i and -f do not work as documented
Message-ID:  <200102121530.f1CFU7M87728@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/25015; it has been noted by GNATS.

From: Garrett Wollman <wollman@khavrinen.lcs.mit.edu>
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)

 <<On Sun, 11 Feb 2001 21:48:55 +0100 (CET), mkamm@gmx.net said:
 
 > 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200102121530.f1CFU7M87728>