Patch for cp(1)

Bruce Evans bde at
Fri Apr 1 23:46:17 PST 2005

On Fri, 1 Apr 2005, David Schultz wrote:

> On Sat, Apr 02, 2005, Bruce Evans wrote:
>> -r is the same as -R under Linux (linux_base_8), and it isn't even
>> deprecated
>> in cp --help at least, so it won't go away, and fingers will be trained to
>> use it in preference to -R, for at least another 20 years.
> Isn't that an argument *for* Tom's patch?  In any case, I think

Of course not.  It is an argument for removing -r.

NetBSD hasn't changed the behaviour of -r.

> the argument about old programs is bogus, because there are
> undoubtedly more scripts that assume the Linux behavior than there
> are pre-4.2BSD scripts out there.

Probably not many running on BSD systems, since if they assume Linux
semantics then they won't work except on directories and regular files.

> Furthermore, are there situations where -r and -R differ such that
> -r would behave reasonably?  If it's the case that every time

As I said, the main case where cp -r gives useful behaviour is for
symlinks, where you actually want to follow symlinks but don't know
about cp -RL.

> someone uses -r they really mean -R, then simply eliminating -r is
> worse than making it an alias for -R.

No, it just forces them to use a portable flag.

BTW, there are several utilities whose support for tree walks is deficient
due to their only having a -r flag and not having caught up with the 13+
year old -RHLP flags.  diff is the most important one.


More information about the freebsd-standards mailing list