Skip to contentSkip to conversation

Manual pages: unshare.1: clarify description and example for --mount=<path>

PATCH In review Michael Kerrisk (man-pages) 2 participants 4 messages Jun 3, 2020 Util-Linux package

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 Manual pages: unshare.1: clarify description and example for --mount=<path>

The existing text is not quite accurate, and I recently injected an error into the EXAMPLES. This patch fixes both issues.

The text in DESCRIPTION incorrectly states that the propagation type of the parent mount must be "private". This is not accurate. Rather, the propagation type must be something *other than "shared"* (i.e., "private", "slave", or "unbindable").

In the EXAMPLES section, I added text that implies that if the propagation type of the parent mount is "shared", then the child mount created by --mount=<path> might propagate to another namespace. Rather, in this situation, an error would result. Clarify that.

---
 sys-utils/unshare.1 | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
sys-utils/unshare.1 +6 -7
index a260d02e3..443aac658 100644
@@ -104,8 +104,9 @@ namespace is created by a bind mount.
 .BR \-m , " \-\-mount" [ =\fIfile ]
 Unshare the mount namespace.  If \fIfile\fP is specified, then a persistent
 namespace is created by a bind mount.
-Note that \fIfile\fP has to be located on a filesystem with the propagation
-flag set to \fBprivate\fP.  Use the command \fBfindmnt \-o+PROPAGATION\fP
+Note that \fIfile\fP must be located on a mount whose propagation type
+is not \fBshared\fP (or an error results).
+Use the command \fBfindmnt \-o+PROPAGATION\fP
 when not sure about the current setting.  See also the examples below.
 .TP
 .BR \-n , " \-\-net" [ =\fIfile ]
@@ -307,13 +308,11 @@ FOO
 The following commands
 establish a persistent mount namespace referenced by the bind mount
 .IR /root/namespaces/mnt .
-In order to ensure that this bind mount does not get propagated
-to other mount namespaces,
+In order to ensure that the creation of that bind mount succeeds,
 the parent directory
 .RI ( /root/namespaces )
-is first made a bind mount with
-.I private
-propagation.
+is made a bind mount whose propagation type is not
+.BR shared .
 .PP
 .in +4n
 .EX
Signature · 1 line
2.26.2
#1 lore raw

PATCH 2/2 Manual pages: unshare.1: clarify that --pid=<file> requires --fork

Attempting to create a persistent PID namespace with --pid=<file> will result in an error if --fork is not also specified. Let's warn people about that, so they don't get puzzled.

---
 sys-utils/unshare.1 | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
sys-utils/unshare.1 +7 -2
index 443aac658..7899db3ad 100644
@@ -114,8 +114,13 @@ Unshare the network namespace.  If \fIfile\fP is specified, then a persistent
 namespace is created by a bind mount.
 .TP
 .BR \-p , " \-\-pid" [ =\fIfile ]
-Unshare the PID namespace.  If \fIfile\fP is specified then persistent
-namespace is created by a bind mount.  See also the \fB\-\-fork\fP and
+Unshare the PID namespace.  If \fIfile\fP is specified, then a persistent
+namespace is created by a bind mount.
+(Creation of a persistent PID namespace will fail if the
+.B \-\-fork
+is not also specified.)
+.IP
+See also the \fB\-\-fork\fP and
 \fB\-\-mount-proc\fP options.
 .TP
 .BR \-u , " \-\-uts" [ =\fIfile ]
Signature · 1 line
2.26.2
#2 lore raw

Re: [PATCH 2/2] Manual pages: unshare.1: clarify that --pid=<file> requires --fork

sys-utils/unshare.1 Unshare the network namespace. If \fIfile\fP is specified, then a persistent · line 121

Quoted 3 lines
sys-utils/unshare.1 +3 -0
+(Creation of a persistent PID namespace will fail if the
+.B \-\-fork
+is not also specified.)

Small wording problem there... s/is/option is/

Should I send a new patch, or will you hand edit?

Thanks,

Michael

Signature · 3 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
maintainer
#3 lore raw

Re: [PATCH 2/2] Manual pages: unshare.1: clarify that --pid=<file> requires --fork

Quoted 5 lines · Michael Kerrisk (man-pages)

sys-utils/unshare.1 Unshare the network namespace. If \fIfile\fP is specified, then a persistent · line 121

Quoted 3 lines
sys-utils/unshare.1 +3 -0
+(Creation of a persistent PID namespace will fail if the
+.B \-\-fork
+is not also specified.)

Small wording problem there... s/is/option is/

Applied & fixed, thanks!

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com