Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 3 Apr 2005 17:52:41 +1000 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        David Schultz <das@FreeBSD.org>
Cc:        standards@FreeBSD.org
Subject:   Re: Patch for cp(1)
Message-ID:  <20050403173947.Y30455@delplex.bde.org>
In-Reply-To: <20050402100736.GA53369@VARK.MIT.EDU>
References:  <20050330181904.16519571@mobile.pittgoth.com> <200504011517.j31FHxTO084986@khavrinen.lcs.mit.edu> <20050401172207.GA23665@VARK.MIT.EDU> <20050402100736.GA53369@VARK.MIT.EDU>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 2 Apr 2005, David Schultz wrote:

> On Sat, Apr 02, 2005, Bruce Evans wrote:
>> On Fri, 1 Apr 2005, David Schultz wrote:
>>> 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?

I would be happy with that.  Maybe people who want -r to be the same as
-R wouldn't be.

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

Hmm, -[rR] is even more tangled and broken for grep than for cp.  The
tangled history is:
- wosch added -R in 1996 in grep.c 1.5.  ISTR complaining that it wasn't
   accompanied by [HLP].
- gnu added -r, and we merged the changes in grep.c 1.14.
- -R was lost in grep.c 1.14 and restored as an alias for -r in 1.15.
So we now have -R == -r, and can't fix -R without adding a new option.

While I'm wishing for utilities to handle links correctly, I'll wish
for a zgrep thet can skip all hard links except the first in
"zgrep -r foo /usr/share/man".

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

I didn't know about grep -D.

Bruce



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