From 9b6cce9936d521580f8927fb1d73bec9156545ef Mon Sep 17 00:00:00 2001 From: Michael Kerrisk Date: Mon, 9 Aug 2021 01:02:18 +0200 Subject: [PATCH] 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 --- man7/path_resolution.7 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/man7/path_resolution.7 b/man7/path_resolution.7 index f24837ef9..749f6900b 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