coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] doc: fix stale --dereference info for chown/chgrp


From: Pádraig Brady
Subject: [PATCH] doc: fix stale --dereference info for chown/chgrp
Date: Mon, 18 Mar 2024 18:31:40 +0000

Following v5.2.1-679-g7e29ef8b8 symlinks specified on the command line
no longer induce an error if lchown() is not supported on the system.

* doc/coreutils.texi (chown invocation, chgrp invocation): Adjust
accordingly, and also use a macro to avoid duplication.
* src/chown-core.c: Use our more standard is_ENOTSUP() wrapper
in the code related to this.
---
 doc/coreutils.texi | 32 ++++++--------------------------
 src/chown-core.c   |  2 +-
 2 files changed, 7 insertions(+), 27 deletions(-)

diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index d07ed7e76..09e3e9d3f 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -11656,9 +11656,10 @@ though still not perfect:
 @end macro
 @chownFromOption{chown}
 
+@macro symlinkRefOpts
 @item --dereference
 @opindex --dereference
-@cindex symbolic links, changing owner
+@cindex symbolic links, changing owner, group
 @findex lchown
 Do not act on symbolic links themselves but rather on what they point to.
 This is the default when not operating recursively.
@@ -11673,10 +11674,9 @@ This is the default when not operating recursively.
 Act on symbolic links themselves instead of what they point to.
 This mode relies on the @code{lchown} system call.
 On systems that do not provide the @code{lchown} system call,
-@command{chown} fails when a file specified on the command line
-is a symbolic link.
-By default, no diagnostic is issued for symbolic links encountered
-during a recursive traversal, but see @option{--verbose}.
+no diagnostic is issued, but see @option{--verbose}.
+@end macro
+@symlinkRefOpts
 
 @item --preserve-root
 @opindex --preserve-root
@@ -11790,27 +11790,7 @@ changed.
 
 @chownFromOption{chgrp}
 
-@item --dereference
-@opindex --dereference
-@cindex symbolic links, changing owner
-@findex lchown
-Do not act on symbolic links themselves but rather on what they point to.
-This is the default when not operating recursively.
-@warnOptDerefWithRec
-
-@item -h
-@itemx --no-dereference
-@opindex -h
-@opindex --no-dereference
-@cindex symbolic links, changing group
-@findex lchown
-Act on symbolic links themselves instead of what they point to.
-This mode relies on the @code{lchown} system call.
-On systems that do not provide the @code{lchown} system call,
-@command{chgrp} fails when a file specified on the command line
-is a symbolic link.
-By default, no diagnostic is issued for symbolic links encountered
-during a recursive traversal, but see @option{--verbose}.
+@symlinkRefOpts
 
 @item --preserve-root
 @opindex --preserve-root
diff --git a/src/chown-core.c b/src/chown-core.c
index fb5d4fe17..5776c6a79 100644
--- a/src/chown-core.c
+++ b/src/chown-core.c
@@ -420,7 +420,7 @@ change_file_owner (FTS *fts, FTSENT *ent,
           /* Ignore any error due to lack of support; POSIX requires
              this behavior for top-level symbolic links with -h, and
              implies that it's required for all symbolic links.  */
-          if (!ok && errno == EOPNOTSUPP)
+          if (!ok && is_ENOTSUP (errno))
             {
               ok = true;
               symlink_changed = false;
-- 
2.43.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]