coreutils
[Top][All Lists]
Advanced

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

Re: coreutils/man/rm.x - fails to mention POSIX "Refuse to remove path/.


From: Pádraig Brady
Subject: Re: coreutils/man/rm.x - fails to mention POSIX "Refuse to remove path/. and path/.., as well as `.' and `..'
Date: Mon, 25 Sep 2023 15:09:18 +0100
User-agent: Mozilla Thunderbird

On 23/09/2023 18:22, James Feeney via GNU coreutils General Discussion wrote:
coreutils 9.3
coreutils/man/rm.x

Even though "rm" was modified,
====
Sat Apr 20 00:03:09 1991  David J. MacKenzie  (djm at geech.gnu.ai.mit.edu)
...
* rm.c (rm): Refuse to remove path/. and path/.., as well as `.' and `..', for 
POSIX.
...
====
the rm(1) man page completely fails to mention this particular POSIX promise.

If the user already knows how GNU rm will respond to "rm -rf *", they don't 
need to look at the man page.

If the user does *not* know how GNU rm will respond to "rm -rf *", the GNU rm 
man page is not going to help them.

Language should be added to the GNU rm man page explicitly stating the POSIX 
behavior:
====
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.
====
including the additional requirement with respect to the root directory.

This is already mentioned in the info docs referenced from the man page. i.e.:
https://www.gnu.org/software/coreutils/rm

But I agree the man page should mention it.
I'd simplify the text though, and not mention anything about '/'
as that's more of an edge case, and already described
with the --preserve-root option.

I'll add the following to the man page:

 "Any attempt to remove a file whose last file name component is '.' or '..'
  is rejected with a diagnostic."

cheers,
Pádraig



reply via email to

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