Patch for cp(1)

David Schultz das at FreeBSD.ORG
Sat Apr 2 02:08:00 PST 2005


On Sat, Apr 02, 2005, Bruce Evans wrote:
> 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.

As (I think) Tom meant to suggest in his last message, -r could be
made an alias for -RL.  That would result in behavior less
surprising than to most people than either -r's current behavior
or removing -r entirely.  Do you agree?

> 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.

What I really want is a grep -R that understands how to skip
special files.  Actually, grep -R already exists, but it's just an
alias for -r.  You have to say 'grep -D skip -R', which I never
remember until I've drummed my fingers on the keyboard for a while
waiting for grep to finish.  Actually, I think I'll go make an
alias now...


More information about the freebsd-standards mailing list