Hi, The texi documentation of chcon does not mention the options --dereference, --preserve-root and --no-preserve-root, while the usage message just misses the latter two. The third attached patch fixes this, plus a missing word in the general description of the --preserve options.
The second attached patch removes a stray parenthesis in the documentation of cp. In the description of --force for cp, saying that -f is redundant when -n is specified makes it sound as if -n encompasses -f, whereas in fact -n cancels, nullifies, overrides -f. So the first attached patch changes "redundant" to "ignored". Regards, Benno -- http://www.fastmail.fm - mmm... Fastmail...
From 9ccf1c6e310d559362a25d88c3246e47f1687a3b Mon Sep 17 00:00:00 2001 From: Benno Schulenberg <bensb...@justemail.net> Date: Mon, 15 Oct 2012 13:06:37 +0200 Subject: [PATCH 1/3] cp: with option -n option -f is not redundant but ignored * src/cp.c (usage): Replace "redundant" with "ignored". * doc/coreutils.texi (cp invocation): Likewise. --- doc/coreutils.texi | 4 ++-- src/cp.c | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/doc/coreutils.texi b/doc/coreutils.texi index 63ad22b..d3e24fe 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi @@ -7734,8 +7734,8 @@ description of @option{--remove-destination}. This option is independent of the @option{--interactive} or @option{-i} option: neither cancels the effect of the other. -This option is redundant if the @option{--no-clobber} or @option{-n} option is -used. +This option is ignored when the @option{--no-clobber} or @option{-n} option +is also used. @item -H @opindex -H diff --git a/src/cp.c b/src/cp.c index 61b31af..231d6a3 100644 --- a/src/cp.c +++ b/src/cp.c @@ -177,9 +177,8 @@ Mandatory arguments to long options are mandatory for short options too.\n\ "), stdout); fputs (_("\ -f, --force if an existing destination file cannot be\n\ - opened, remove it and try again (redundant if\ -\n\ - the -n option is used)\n\ + opened, remove it and try again (this option\n\ + is ignored when the -n option is also used)\n\ -i, --interactive prompt before overwrite (overrides a previous -n\ \n\ option)\n\ -- 1.7.0.4
From eb4163d320b0c0c34495d19656856b3da6461e63 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg <bensb...@justemail.net> Date: Mon, 15 Oct 2012 13:12:46 +0200 Subject: [PATCH 2/3] doc: remove a stray parenthesis from description of 'cp --force' * doc/coreutils.texi (cp invocation): Remove Cheshire Cat. --- doc/coreutils.texi | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/doc/coreutils.texi b/doc/coreutils.texi index d3e24fe..cac66a4 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi @@ -7724,7 +7724,7 @@ Equivalent to @option{--no-dereference --preserve=links}. @opindex -f @opindex --force When copying without this option and an existing destination file cannot -be opened for writing, the copy fails. However, with @option{--force}), +be opened for writing, the copy fails. However, with @option{--force}, when a destination file cannot be opened, @command{cp} then removes it and tries to open it again. Contrast this behavior with that enabled by @option{--link} and @option{--symbolic-link}, whereby the destination file -- 1.7.0.4
From 6b8f01f8cb4094e1e45db72bfae7cfefad273525 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg <bensb...@justemail.net> Date: Mon, 15 Oct 2012 19:37:34 +0200 Subject: [PATCH 3/3] chcon: add descriptions for three undocumented options * src/chcon.c (usage): Mention the two --preserve-root options. * doc/coreutils.texi (chcon invocation): Plus the --dereferece option. --- doc/coreutils.texi | 20 ++++++++++++++++++-- src/chcon.c | 6 ++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/doc/coreutils.texi b/doc/coreutils.texi index cac66a4..9486eb2 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi @@ -1384,7 +1384,7 @@ legitimate uses for such a command, that resolves to @file{/}. If you really want to try to remove all the files on your system, you can use the @option{--no-preserve-root} option, but the default behavior, specified by the -@option{--preserve-option}, is safer for most purposes. +@option{--preserve-root} option, is safer for most purposes. The commands @command{chgrp}, @command{chmod} and @command{chown} can also operate destructively on entire hierarchies, so they too @@ -15190,12 +15190,16 @@ The program accepts the following options. Also see @ref{Common options}. @table @samp +@item --dereference +@opindex --dereference +Do not affect symbolic links but what they refer to; this is the default. + @item -h @itemx --no-dereference @opindex -h @opindex --no-dereference @cindex no dereference -Affect symbolic links instead of any referenced file. +Affect the symbolic links themselves instead of any referenced file. @item --reference=@var{rfile} @opindex --reference @@ -15208,6 +15212,18 @@ Use @var{rfile}'s security context rather than specifying a @var{context} value. @opindex --recursive Operate on files and directories recursively. +@item --preserve-root +@opindex --preserve-root +Refuse to operate recursively on the root directory, @file{/}, +when used together with the @option{--recursive} option. +@xref{Treating / specially}. + +@item --no-preserve-root +@opindex --no-preserve-root +Do not treat the root directory, @file{/}, specially when operating +recursively; this is the default. +@xref{Treating / specially}. + @choptH @xref{Traversing symlinks}. diff --git a/src/chcon.c b/src/chcon.c index 34e92e4..c0eec51 100644 --- a/src/chcon.c +++ b/src/chcon.c @@ -378,6 +378,12 @@ With --reference, change the security context of each FILE to that of RFILE.\n\ -R, --recursive operate on files and directories recursively\n\ "), stdout); fputs (_("\ + --preserve-root refuse to operate recursively on the root directory\n\ +"), stdout); + fputs (_("\ + --no-preserve-root do not treat the root directory specially (default)\n\ +"), stdout); + fputs (_("\ -v, --verbose output a diagnostic for every file processed\n\ "), stdout); fputs (_("\ -- 1.7.0.4