From: Michael Kerrisk Date: Sun, 8 Aug 2021 23:02:18 +0000 (+0200) Subject: path_resolution.7: Improve description of trailin slashes X-Git-Tag: man-pages-5.13~112 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9b6cce9936d521580f8927fb1d73bec9156545ef;p=thirdparty%2Fman-pages.git 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 Signed-off-by: Michael Kerrisk --- diff --git a/man7/path_resolution.7 b/man7/path_resolution.7 index f24837ef9c..749f6900bb 100644 --- a/man7/path_resolution.7 +++ b/man7/path_resolution.7 @@ -177,10 +177,11 @@ with the flag set (though note that this also restricts bind mount traversal). .SS Trailing slashes 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. -(Or, equivalently, a pathname with a trailing \(aq/\(aq is equivalent to -the pathname obtained by appending \(aq.\(aq to it.) .SS Final symlink 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