From owner-freebsd-questions Fri Dec 20 21:44:51 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id AE06937B401 for ; Fri, 20 Dec 2002 21:44:49 -0800 (PST) Received: from post-20.mail.nl.demon.net (post-20.mail.nl.demon.net [194.159.73.1]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9D61443EDC for ; Fri, 20 Dec 2002 21:44:48 -0800 (PST) (envelope-from cls@raggedclown.net) Received: from [212.238.197.102] (helo=mailhost.raggedclown.net) by post-20.mail.nl.demon.net with esmtp (Exim 3.36 #1) id 18PcRL-000EH7-00 for freebsd-questions@FreeBSD.ORG; Sat, 21 Dec 2002 05:44:47 +0000 Received: from localhost (localhost [127.0.0.1]) by mailhost.raggedclown.net (Ragged Clown Mail Gateway [dawn]) with ESMTP id 58F631962 for ; Sat, 21 Dec 2002 06:44:45 +0100 (CET) Received: from willow.raggedclown.net (willow.raggedclown.intra [192.168.1.10]) by mailhost.raggedclown.net (Ragged Clown Mail Gateway [dawn]) with ESMTP id 948AC16B6 for ; Sat, 21 Dec 2002 06:44:13 +0100 (CET) Received: by willow.raggedclown.net (Ragged Clown Host [willow], from userid 1009) id B2862225DC; Sat, 21 Dec 2002 06:00:46 +0100 (CET) Date: Sat, 21 Dec 2002 06:00:46 +0100 From: Cliff Sarginson To: freebsd-questions@FreeBSD.ORG Subject: Re: chown broken?? Message-ID: <20021221050046.GA46365@raggedclown.net> References: <1040390551.921.36.camel@localhost> <200212201412.GBKECSM91804@asarian-host.net> <20021220141504.GB6893@submonkey.net> <200212201448.GBKEMQM99487@asarian-host.net> <20021221034927.GA804@HAL9000.homeunix.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20021221034927.GA804@HAL9000.homeunix.com> User-Agent: Mutt/1.5.1i X-Virus-Scanned: by AMaViS 0.3.12pre8 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Fri, Dec 20, 2002 at 07:49:27PM -0800, David Schultz wrote: > Thus spake Mark : > > ----- Original Message ----- > > From: "Ceri Davies" > > To: "Mark" > > Cc: "Andrew Cutler" ; > > Sent: Friday, December 20, 2002 3:15 PM > > Subject: Re: chown broken?? > > > > > > > On Fri, Dec 20, 2002 at 03:12:17PM +0100, Mark wrote: > > > > > > > I must say, though, that while I understand this behaviour, one can > > > > argue on what exactly "recursive" is to mean here. Intuitively, > > > > the definition of "the current sub-directory and all sub-directories > > > > below the current directory (and that for each subdirectory)" seems > > > > the correct one. Which would exclude "..", as this is not a > > sub-directory > > > > of the current directory, but the parent. > > > > > > Not really. It recurses through the directories named on the command > > > line, of which '..' happens to be one. > > > > > > Yes, "the directories named on the command line" within the CURRENT > > directory. Technically, "." and ".." are entries within the current > > directory (try: "od -c ."), and they have inode numbers too. But that does > > not deter me from deeming it a bit counter-intuitive to consider ".." a > > directory of the current directory. :) Especially in the context of > > recursion. > > So you want 'chown foo ..' to fail, as a special case? As I > mentioned before, rm gets away with this because you don't want to > remove the parent of the directory you're currently in. > (Actually, some rm implementations *will* let you shoot yourself > in the foot.) But it's perfectly reasonable to chown '..', even > recursively, so chown can't make any assumptions. > > I object to going around and documenting this caveat in the > manpages for every single utility that supports recursion through > a directory tree. It doesn't really belong there, it belongs in a > ``How to use the shell'' tutorial. The way Unix traditionally > does parameter expansion makes it easy to shoot yourself in the > foot in at least a dozen ways, and this is just one of them. > There is a little comfort-factor trick for all of this, that I use a lot on those paranoid days, execute the command first with an "echo" in front of it, then you will see what is going to happen..for example: [admin@willow]:~$ echo chown cls:cls .* chown cls:cls . .. .bash_history .bashrc .cshrc .forward .login .login_conf .mail_aliases .mailcap .mailrc .muttrc .procmailrc .profile .rhosts .shrc .signature .ssh [admin@willow]:~$ Of course this may not be 100% the truth if the program you are echoing makes a special case of "." etc. But it does show you what the shell will expand your command line to. -- Regards Cliff Sarginson The Netherlands [ This mail has been checked as virus-free ] To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message