* [Bug 73301] Documentation misses case of symlink, symlinkat giving ENOENT for a directory with a reference only held by a process
[not found] ` <bug-73301-11311-3bo0kxnWaOQUvHkbgXJLS5sdmw4N0Rt+2LY78lusg7I@public.gmane.org/>
@ 2014-03-31 19:22 ` bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r
2014-03-31 19:22 ` [Bug 73301] Documentation misses case of link, linkat, " bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r @ 2014-03-31 19:22 UTC (permalink / raw)
To: linux-man-u79uwXL29TY76Z2rM5mHXA
https://bugzilla.kernel.org/show_bug.cgi?id=73301
--- Comment #1 from Steven Stewart-Gallus <sstewartgallus00-QKvm5KDIoDa7M0a00MdBSQ@public.gmane.org> ---
This problem also exists with link and linkat.
--
You are receiving this mail because:
You are watching the assignee of the bug.
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 6+ messages in thread* [Bug 73301] Documentation misses case of link, linkat, symlink, symlinkat giving ENOENT for a directory with a reference only held by a process
[not found] ` <bug-73301-11311-3bo0kxnWaOQUvHkbgXJLS5sdmw4N0Rt+2LY78lusg7I@public.gmane.org/>
2014-03-31 19:22 ` [Bug 73301] " bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r
@ 2014-03-31 19:22 ` bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r
2014-05-02 13:11 ` bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r @ 2014-03-31 19:22 UTC (permalink / raw)
To: linux-man-u79uwXL29TY76Z2rM5mHXA
https://bugzilla.kernel.org/show_bug.cgi?id=73301
Steven Stewart-Gallus <sstewartgallus00-QKvm5KDIoDa7M0a00MdBSQ@public.gmane.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|Documentation misses case |Documentation misses case
|of symlink, symlinkat |of link, linkat, symlink,
|giving ENOENT for a |symlinkat giving ENOENT for
|directory with a reference |a directory with a
|only held by a process |reference only held by a
| |process
--
You are receiving this mail because:
You are watching the assignee of the bug.
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 6+ messages in thread* [Bug 73301] Documentation misses case of link, linkat, symlink, symlinkat giving ENOENT for a directory with a reference only held by a process
[not found] ` <bug-73301-11311-3bo0kxnWaOQUvHkbgXJLS5sdmw4N0Rt+2LY78lusg7I@public.gmane.org/>
2014-03-31 19:22 ` [Bug 73301] " bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r
2014-03-31 19:22 ` [Bug 73301] Documentation misses case of link, linkat, " bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r
@ 2014-05-02 13:11 ` bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r
2014-05-02 18:51 ` bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r
2014-05-05 11:06 ` bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r
4 siblings, 0 replies; 6+ messages in thread
From: bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r @ 2014-05-02 13:11 UTC (permalink / raw)
To: linux-man-u79uwXL29TY76Z2rM5mHXA
https://bugzilla.kernel.org/show_bug.cgi?id=73301
Michael Kerrisk <mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
--- Comment #2 from Michael Kerrisk <mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> ---
Steven,
(In reply to Steven Stewart-Gallus from comment #0)
> The errors printed out by the following code on symlink and symlinkat are
> missed by the documentation.
>
> #include <fcntl.h>
> #include <stdio.h>
> #include <sys/stat.h>
> #include <sys/types.h>
> #include <unistd.h>
>
> int main() {
> if (-1 == mkdir("/tmp/temporary", S_IRWXU)) {
> perror("mkdir");
> }
>
> int dir = open("/tmp/temporary", O_RDONLY | O_CLOEXEC);
> if (-1 == dir) {
> perror("open");
> }
>
> if (-1 == rmdir("/tmp/temporary")) {
> perror("rmdir");
> }
>
> if (-1 == symlinkat("/", dir, "root")) {
> perror("symlinkat");
> }
So far, so good.
> char template_text[] = "/proc/self/fd/XXXXXXXXXXX/root";
> sprintf(template_text, "/proc/self/fd/%i/root", dir);
> if (-1 == symlink("/", template_text)) {
> perror("symlink");
> }
I'm a little puzzled, why would one want to make a symlink somewhere under
/proc?
>
> return 0;
> }
>
> The calls to symlink and symlinkat in this case give ENOENT errors.
For symlinkat(), I can see the logic. You're trying to create a link relative
to a directory that does not exist. Could the call reasonably do anything other
than fail?
> This
> might also be a small oversight which is probably impossible to change now.
> I wonder if the code thinks this is a dangling symbolic link (a case which
> is mentioned by the documentation)?
>
> The POSIX standard issue 7 also seems to miss this corner case (although it
> might simply be an omission of mentioning a system dependant case rather
> than a bug for the POSIX standard).
The specs in POSIX were driven from the Linux implementation effort, so I don;t
think that your hypothesis there would fit.
> I'm not sure how exactly one would explain this corner case in the
> documentation.
I'd be willing to give it a shot, but, first,I'm not sure what if anything to
say about the symlink() case. Do you have a more realistic example of that
case?
--
You are receiving this mail because:
You are watching the assignee of the bug.
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 6+ messages in thread* [Bug 73301] Documentation misses case of link, linkat, symlink, symlinkat giving ENOENT for a directory with a reference only held by a process
[not found] ` <bug-73301-11311-3bo0kxnWaOQUvHkbgXJLS5sdmw4N0Rt+2LY78lusg7I@public.gmane.org/>
` (2 preceding siblings ...)
2014-05-02 13:11 ` bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r
@ 2014-05-02 18:51 ` bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r
2014-05-05 11:06 ` bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r
4 siblings, 0 replies; 6+ messages in thread
From: bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r @ 2014-05-02 18:51 UTC (permalink / raw)
To: linux-man-u79uwXL29TY76Z2rM5mHXA
https://bugzilla.kernel.org/show_bug.cgi?id=73301
--- Comment #3 from Steven Stewart-Gallus <sstewartgallus00-QKvm5KDIoDa7M0a00MdBSQ@public.gmane.org> ---
On further reflection, this is not a problem with the documentation of
symlink, symlinkat, link and linkat but a problem with the
documentation of ENOENT and what a nonexisting directory actually
means.
I suppose how one might describe the situation is that when a
directory is unlinked from a filesystem (but still has process
references to it) it enters a zombie state where many filesystem calls
become inappropriate to use on it.
I'm not sure where such documentation should be placed. We already
have shm_overview(7), mq_overview(7) and such; and I think if we had a
dir_overview(7) that would be the perfect place to put this corner
case. dir_overview(7) might be too big project for not really any gain
though.
> I'd be willing to give it a shot, but, first,I'm not sure what if
> anything to say about the symlink() case. Do you have a more
> realistic example of that case?
Nope. People should probably be able to figure that out from the
description of the symlink case. I was just pointing it out for
completeness and I'd be fine if that case was omitted.
--
You are receiving this mail because:
You are watching the assignee of the bug.
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 6+ messages in thread* [Bug 73301] Documentation misses case of link, linkat, symlink, symlinkat giving ENOENT for a directory with a reference only held by a process
[not found] ` <bug-73301-11311-3bo0kxnWaOQUvHkbgXJLS5sdmw4N0Rt+2LY78lusg7I@public.gmane.org/>
` (3 preceding siblings ...)
2014-05-02 18:51 ` bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r
@ 2014-05-05 11:06 ` bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r
4 siblings, 0 replies; 6+ messages in thread
From: bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r @ 2014-05-05 11:06 UTC (permalink / raw)
To: linux-man-u79uwXL29TY76Z2rM5mHXA
https://bugzilla.kernel.org/show_bug.cgi?id=73301
Michael Kerrisk <mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |CODE_FIX
--- Comment #4 from Michael Kerrisk <mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> ---
I've applied the patches below.
diff --git a/man2/link.2 b/man2/link.2
index d5a697d..df2b9e2 100644
--- a/man2/link.2
+++ b/man2/link.2
@@ -291,6 +291,17 @@ file corresponding to a file descriptor created with
See
.BR open (2).
.TP
+.B ENOENT
+.I oldpath
+is a relative pathname and
+.I olddirfd
+refers to a directory that has been deleted,
+or
+.I newpath
+is a relative pathname and
+.I newdirfd
+refers to a directory that has been deleted.
+.TP
.B ENOTDIR
.I oldpath
is relative and
diff --git a/man2/symlink.2 b/man2/symlink.2
index a6cf6a7..8bd067f 100644
--- a/man2/symlink.2
+++ b/man2/symlink.2
@@ -210,6 +210,12 @@ The following additional errors can occur for
.I newdirfd
is not a valid file descriptor.
.TP
+.B ENOENT
+.I linkpath
+is a relative pathname and
+.IR newdirfd
+refers to a directory that has been deleted.
+.TP
.B ENOTDIR
.I linkpath
is relative and
--
You are receiving this mail because:
You are watching the assignee of the bug.
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 6+ messages in thread