Duplicate accounts?

Patrick O'Callaghan pocallaghan at gmail.com
Tue Mar 1 03:50:40 UTC 2011


On Mon, 2011-02-28 at 20:01 -0600, Larry Brower wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA512
> 
> On 02/28/2011 06:54 PM, Steve Ellis wrote:
> > On 2/28/2011 3:23 PM, Larry Brower wrote:
> >>
> >> I would say this all depends on the application being invoked and would
> >> still say it is bad to just use * as opposed to say ./*
> >>
> >> I can't count the number of people Ive seen do things like rm -rf * in a
> >> directory and it recursively started working on / and /bin  etc...
> > Not to be a pest, but if you worry about '*' expanding to include 
> > dotfiles, then why do you think that './*' is safe?  Furthermore, '*' 
> > expansion is handled by the shell, not the application--in other words, 
> > dotglob rules the day.
> > 
> > The '*' there will just as well include dotfiles (i.e., it won't unless 
> > dotglob is set as another poster indicated).  I definitely agree that 
> > caution is warranted when using '*' in any command that can do horrible 
> > things to your files, especially for things like 'rm -rf', but don't 
> > travel under the misconception that './*' is going to save your 
> > bacon--because it won't.
> > 
> > -se
> 
> 
> ./ explicitly specifies the CWD so what is your basis for saying it
> wont? While I will admit there could be other factors at play for rm
> recursively working on the systems Ive seen it happen on I can't say
> with certainty that there was as files like /etc/profile and /etc/bashrc
> were already removed by the time I had to work on the issue.

You're confusing path searching, which ./ will block (e.g. run ./ls
instead of ls) with filename expansion, which ./ will have no effect on.

If you do "cd /; rm -rf *" then bad things will happen. If you do "cd /;
rm -rf ./*" then exactly the same bad things will happen.

poc



More information about the users mailing list