1

I have testlink -> testtarget// and rm and rmdir report the following:

$ rm testlink/
rm: cannot remove 'testlink/': Is a directory
$ rmdir testlink/
rmdir: failed to remove 'testlink/': Not a directory

Of course I can remove the symlink with rm testlink, but why does Linux report that the symlink is both a directory and not a directory?

Paul
  • 507
  • Is testtarget a directory? – Arkadiusz Drabczyk Jan 23 '21 at 00:58
  • 1
    Anyway, this looks like a bug in GNU coreutils https://unix.stackexchange.com/a/29836/72304 – Arkadiusz Drabczyk Jan 23 '21 at 01:18
  • 2
    Or maybe even in Linux https://lists.gnu.org/archive/html/bug-coreutils/2014-11/msg00028.html – Arkadiusz Drabczyk Jan 23 '21 at 01:28
  • @ArkadiuszDrabczyk Yes, testtarget is a directory. – Paul Jan 23 '21 at 01:35
  • @ArkadiuszDrabczyk It seems that this behavior of Linux is intentional, rather than a bug. Anyways, it's probably too late to change, and having rmdir src/ remove the directory that src points to -- turning src it into a dangling symlink without removing it (as it actually happens on BSD), doesn't feel like something that useful, either. –  Jan 23 '21 at 12:18

0 Answers0