bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

coreutils 'rm /' incompatibility with 2006-06-30 draft POSIX


From: Paul Eggert
Subject: coreutils 'rm /' incompatibility with 2006-06-30 draft POSIX
Date: Thu, 31 Aug 2006 11:14:14 -0700
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux)

The 2006-06-30 draft of POSIX has this new requirement for 'rm':

  if an operand resolves to the root directory, rm shall write a
  diagnostic message to standard error and do nothing more

  (XCUd1 page 834 lines 32337-32338)

Traditional 'rm' has this behavior, e.g., Solaris 10:

  $ /bin/rm -ir /
  rm of / is not allowed

but GNU 'rm' does not:

  $ rm -ir /
  rm: descend into write-protected directory `/'? ^C

I prefer the traditional (and soon-to-be-standardized) behavior, as it
avoids common user errors when -i is not specified, but I don't fully
understand how this is implemented in GNU coreutils so I thought I'd
just report the problem for starters.

A couple of issues I see with the current implementation:

  * The check for root's dev and ino is done recursively, but surely
    it should be done only at the top level?  (I'm not sure why it's
    done recursively now.)  The POSIX requirement talks only about the
    top level, and I don't see how you could recurse to the root.

  * The --preserve-root option should now be the default for 'rm',
    even though it is not the default for chmod/chown/chgrp.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]