Bug 120130 - rm cannot unlink symlinks to directories
Summary: rm cannot unlink symlinks to directories
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: coreutils
Version: rawhide
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Tim Waugh
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2004-04-06 10:09 UTC by Albert Strasheim
Modified: 2007-11-30 22:10 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2004-04-07 08:56:14 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Albert Strasheim 2004-04-06 10:09:52 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040312

Description of problem:
I cannot unlink symlinks to directories using rm -f, rm -rf or just
plain rm.

For example:

mkdir ~/k
cd ~/k
ln -s / foo

rm foo/
rm: cannot remove directory `foo/': Is a directory

rm -f foo/
rm: cannot remove `foo/': Not a directory

rm -rf foo/
rm: cannot remove `foo/': Not a directory

rm -r foo/
rm: descend into write-protected directory `foo/'? [n]
(answering no, rm exits and foo is not removed)

rm -r foo
rm: descend into write-protected directory `foo/'? [y]
rm: descend into write-protected directory `foo//sys'?
...

Version-Release number of selected component (if applicable):
coreutils-5.2.1-3

How reproducible:
Always

Actual Results:  rm doesn't unlink symlinks to directories

Expected Results:  rm should unlink symlinks to directories without
trying to descend them.

Additional info:

The same problem exists on Fedora Core 1 with coreutils-5.0-34.1. The
problem is not present on Red Hat Linux 9 with coreutils-4.5.3-19.0.2.

Comment 1 Tim Waugh 2004-04-07 08:56:14 UTC
[tim@cyberelk k]$ ln -s / foo; rm foo
[tim@cyberelk k]$ ln -s / foo; rm -f foo
[tim@cyberelk k]$ ln -s / foo; rm -rf foo
[tim@cyberelk k]$ ln -s / foo; rm -f foo
[tim@cyberelk k]$ ln -s / foo; rm -r foo
[tim@cyberelk k]$ rpm -q coreutils
coreutils-5.2.1-3

'foo' != 'foo/' -- you are forcing the dereference yourself by adding '/'.


Note You need to log in before you can comment on or make changes to this bug.