Subject: Re: bug#10819: [BUG][RM]

From: Eric Blake <[email-masked]>
Date: Wed, 15 Feb 2012 15:06:05 -0700

tag 10819 needinfo
thanks

On 02/15/2012 08:05 AM, [email-masked] wrote:
> Hello,
> 
> I'm writing to you to inform you of a possible bug in the linux "rm"
> command.
> I've experienced that when using by error the said command as following :
> "rm - rf#*"

That's (probably) not a valid command.  By putting a space between - and
r, you are asking rm to remove the literal files named "-" and any files
that match the glob "rf#*".  Did you mean to type "rm -rf #*" instead,
which says to recursively and without warning remove any files that
match the glob "#*"?

It would help us if your report was actual copy-and-paste contents of
what you really did: ls to list directory contents beforehand, then the
rm call you used, then ls afterwards to show what remains, as well as
how that differs from your expectations.

> if there is no file named #*# (* being the same as in the console,
> anything) in the current directory, rm quits as expected because of the
> incorrect syntax.
> But if there is a file named #*#, rm deletes all the current file's
> content except the said file.

Meanwhile, I'm going to guess that you may be hitting one of our FAQ on
how globbing works, and how to make rm remove what you want it to remove:
https://www.gnu.org/software/coreutils/faq/#Why-doesn_0027t-rm-_002dr-_002a_002epattern-recurse-like-it-should_003f

Look at other FAQ in the vicinity.

-- 
Eric Blake   [email-masked]    +1-919-301-3266
Libvirt virtualization library http://libvirt.org