[Bug 1297147] Re: rm -rf . does not delete content of the dir

Hans Ginzel hans at matfyz.cz
Wed Apr 2 06:33:44 UTC 2014


This bug is also in POSIX:

http://pubs.opengroup.org/onlinepubs/9699919799/utilities/rm.html

If either of the files dot or dot-dot are specified as the basename
portion of an operand (that is, the final pathname component) or if an
operand resolves to the root directory, rm shall write a diagnostic
message to standard error and do nothing more with such operands.

But the paragraph is not considering -r and -f options.

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to coreutils in Ubuntu.
https://bugs.launchpad.net/bugs/1297147

Title:
  rm -rf . does not delete content of the dir

Status in “coreutils” package in Ubuntu:
  New

Bug description:
  Command rm -rf .
  writes:
  rm: cannot remove directory: ‘.’

  That is OK. But it does not delete the content of the dir ‘.’. Command rm -rf * is not the alternative because
  1) it does not include hidden files/directories,
  2) number of files could exceed max command line length.

  Alternative is: find . -delete, but I vote for repairing the rm
  command.

  Commands to reproduce:
  mkdir tmp_rm_test
  cd tmp_rm_test
  echo a>.a
  mkdir b
  ls -A
  rm -rf .
  ls -A
  find . -delete
  ls -A
  cd ..
  rmdir tmp_rm_test

  ProblemType: Bug
  DistroRelease: Ubuntu 13.10
  Package: coreutils 8.20-3ubuntu5
  ProcVersionSignature: Ubuntu 3.11.0-18.12-lowlatency 3.11.10.4
  Uname: Linux 3.11.0-18-lowlatency i686
  ApportVersion: 2.12.5-0ubuntu2.2
  Architecture: i386
  Date: Tue Mar 25 09:57:39 2014
  EcryptfsInUse: Yes
  MarkForUpload: True
  SourcePackage: coreutils
  UpgradeStatus: Upgraded to saucy on 2013-10-24 (152 days ago)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/coreutils/+bug/1297147/+subscriptions



More information about the foundations-bugs mailing list