path_resolution.7: Improve description of trailin slashes

See https://bugzilla.kernel.org/show_bug.cgi?id=212385

some/path/dir/ is not always the same as some/path/dir/:

$ mkdir u
$ rmdir u/.
rmdir: failed to remove 'u/.': Invalid argument
$ rmdir u
$

The text in POSIX.1-2018 Section 4.13 ("Pathname Resolution")
is helpful in pointing to a better wording.

Reported-by: Askar Safin <safinaskar@mail.ru>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2021-08-09 01:02:18 +02:00
parent 06501029e1
commit 9b6cce9936
1 changed files with 4 additions and 3 deletions

View File

@ -177,10 +177,11 @@ with the
flag set (though note that this also restricts bind mount traversal). flag set (though note that this also restricts bind mount traversal).
.SS Trailing slashes .SS Trailing slashes
If a pathname ends in a \(aq/\(aq, that forces resolution of the preceding If a pathname ends in a \(aq/\(aq, that forces resolution of the preceding
component as in Step 2: it has to exist and resolve to a directory. component as in Step 2:
the component preceding the slash either exists and resolves to a directory
of it names a directory that is to be created immediately after the
pathname is resolved.
Otherwise, a trailing \(aq/\(aq is ignored. Otherwise, a trailing \(aq/\(aq is ignored.
(Or, equivalently, a pathname with a trailing \(aq/\(aq is equivalent to
the pathname obtained by appending \(aq.\(aq to it.)
.SS Final symlink .SS Final symlink
If the last component of a pathname is a symbolic link, then it If the last component of a pathname is a symbolic link, then it
depends on the system call whether the file referred to will be depends on the system call whether the file referred to will be