Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 326927 - rm -rf current directory does nothing
Summary: rm -rf current directory does nothing
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High trivial (vote)
Assignee: Gentoo Linux bug wranglers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-04 22:28 UTC by Joel Koglin
Modified: 2010-07-05 23:10 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.