Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 326927

Summary: rm -rf current directory does nothing
Product: Gentoo Linux Reporter: Joel Koglin <JoelKoglin>
Component: [OLD] Core systemAssignee: Gentoo Linux bug wranglers <bug-wranglers>
Status: RESOLVED INVALID    
Severity: trivial CC: jer
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Joel Koglin 2010-07-04 22:28:24 UTC
rm -rf the directory you are in does not throw and error or remove the directory.

Reproducible: Always

Steps to Reproduce:
1. rm -rf `pwd`

Actual Results:  
nothing, the directory is not removed, no error is thrown, you are on a new line in your shell

Expected Results:  
an error is thrown or the directory is removed
Comment 1 Jeroen Roovers (RETIRED) gentoo-dev 2010-07-05 23:10:43 UTC
Works for me:

jeroen@astrid ~ $ mkdir test
jeroen@astrid ~ $ cd test
jeroen@astrid ~/test $ ls -ld
drwxr-xr-x 2 jeroen users 4096 Jul  6 01:06 .
jeroen@astrid ~/test $ rm -rf . || echo beep
rm: cannot remove directory: `.'
beep
jeroen@astrid ~/test $ rm -rf `pwd` || echo beep
jeroen@astrid ~/test $ ls -ld
drwxr-xr-x 0 jeroen users 0 Jul  6 01:06 .
jeroen@astrid ~/test $ cd - && cd -
/home/jeroen
bash: cd: /home/jeroen/test: No such file or directory

It successfully removes the directory, so it doesn't need to report anything to stdout, and then exits with the satisfaction of a job well done.

You then find yourself without solid footing, what with a non-existent CWD and all, so it's the *next* command that is likely to fail, not rm.