[lug] Odd Problem with rm and Symbolic Links

Orion Poplawski orion at cora.nwra.com
Sat Dec 28 20:38:43 MST 2013


On 12/28/2013 06:53 PM, stimits at comcast.net wrote:
> I'm using Fedora 19, fully updated. I'd created a symbolic link with "ln
> -s <real> <symbolic>", but ls -ld shows this as a directory, while a
> simple ls -a --color=auto shows that this is indeed a symbolic link, and
> if I use "ls -l" from the parent the output indicates it is a soft link
> and where the link goes.
>
> rm fails. If I go to "rm <link>" it tells me this is a directory...so
> apparently ls -ld and rm agree, but ls -a --color=auto and ls -l from
> parent DISagree with rm. If I use "rm -f <link>", it refuses, because it
> is a directory.
>
> If I use "rmdir <link>", it also refuses, because it is NOT a directory!
>
> My only success is to "rm -Rf" the link. Sadly, this removes all of the
> subdirectories the link pointed at...removing a symbolic link should not
> remove what it points at! What gives? Was rm or the use of symbolic link
> written to a different standard than I'm used to? Is there some new way
> in fedora to remove a symbolic link without removing what it points to?
> I have a backup of what it removed, but something seems drastically wrong.
>
> Both rm and ln are provided by rpm coreutils-8.21-11.fc19.x86_64.
> Filesystem is a single partition with ext4. Kernel is current
> 3.12.5-200.fc19.x86_64.
>


be aware that:

rm link/

and

rm link

are different.  Tab-completion (which adds the /) can be an issue here.


-- 
Orion Poplawski
Technical Manager                     303-415-9701 x222
NWRA/CoRA Division                    FAX: 303-415-9702
3380 Mitchell Lane                  orion at cora.nwra.com
Boulder, CO 80301              http://www.cora.nwra.com


More information about the LUG mailing list