[bug] 'rm' command ascending into parent directory

Dee'Kej deekej at linuxmail.org
Mon Oct 6 15:07:01 UTC 2014

Hello maintainers!

I think I have found a really nasty bug in the coreutils, more specifically
in the 'rm' command.

I'm currently running Linux Mint 17, with 'coreutils' version:
8.21-1ubuntu5, and I have this alias in my .bashrc (both for me and root):
alias rm = 'rm -i'

Here's what happened:

1) I was in the folder: ~/.ccache/
2) I wanted to delete the content of it (some of the files were owned by
the root), so I used:
    'sudo rm -rf *'
3) The content of .ccache was small, so it should have delete it
immediately. Instead, it was going on, so I pressed CTRL+C to stop it.
4) Then I have found out, it has deleted most of my content in my home ( ~/
) folder.

I'm not replicating this again, because I don't want to loose any more
data. I hope you understand.

However, I think this is not for the first time this has happened to me
with this 'rm' version.

I'm much pretty sure, in previous versions the 'rm' was not acting like
this. The POSIX says the rm should never delete the . and .. files.
(Usually prints some warnings if -f is not used.)

And the -r option should be only descending into children directories. I
think it should never ascend, which happened in this case.

Could you please confirm my suspicions?

Thank you!

 Phone: +41 (0)79 109 23 74 | +420 777 655 769
 E-mail:  deekej.dj at gmail.com
 Skype:  deekej.dj
 Jabber:  deekej at jabber.cz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-devel-discuss/attachments/20141006/5b141a8c/attachment.html>

More information about the Ubuntu-devel-discuss mailing list