There is a discrepancy between POSIX and common practice with respect to how `cp -if a b' should work.
According to POSIX, http://www.opengroup.org/onlinepubs/007904975/utilities/cp.html cp must prompt the user in this case (GNU cp and Solaris cp do this): $ touch a b; /bin/cp -if a b cp: overwrite b (yes/no)? However, many[1] existing implementations of cp do not prompt because they define -f to override any preceding -i option: $ touch a b; /bin/cp -if a b $ POSIX says that -i means `prompt' and that -f is unrelated. POSIX requires cp's -f option to make it so that if an existing destination file cannot be opened, cp removes it and tries again. But bear in mind that for both rm and mv, the -f and -i options *are* related. For both of those tools, a -f option cancels the effect of any preceding -i option. Note that RedHat has been using a patch that makes cp's behavior non-POSIX, yet consistent with that of most other systems, for years. Should GNU cp be changed, too, so that -i and -f are related, and hence, more consistent with how -i and -f work in those other tools? I'm inclined to say yes, but not before the upcoming `stable' release of the coreutils. Does anyone disagree? Jim ------------- [1] The following systems provide an implementation of cp that is not POSIX compliant in that `cp -if a b' completes without prompting: Tru64 V5.1 openbsd 3.2 netbsd 1.6 HPUX B.11.23 Darwin 7.2.0 On the other side of the fence: solaris-5.9 /bin/cp solaris-5.9 /usr/xpg4/bin/cp GNU cp _______________________________________________ Bug-coreutils mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-coreutils
