Make --chown|--usermap|--groupmap imply -o|-g (as appropriate).
authorWayne Davison <wayne@opencoder.net>
Wed, 20 Oct 2021 04:01:58 +0000 (21:01 -0700)
committerWayne Davison <wayne@opencoder.net>
Wed, 20 Oct 2021 04:10:12 +0000 (21:10 -0700)
options.c
rsync.1.md

index d1d540f3d13965913780f9defb6e6dd846a3bc57..3f0354624547257c26b5def14e9e0b9970002f25 100644 (file)
--- a/options.c
+++ b/options.c
@@ -1747,6 +1747,7 @@ int parse_arguments(int *argc_p, const char ***argv_p)
                        }
                        usermap = (char *)poptGetOptArg(pc);
                        usermap_via_chown = False;
+                       preserve_uid = 1;
                        break;
 
                case OPT_GROUPMAP:
@@ -1762,6 +1763,7 @@ int parse_arguments(int *argc_p, const char ***argv_p)
                        }
                        groupmap = (char *)poptGetOptArg(pc);
                        groupmap_via_chown = False;
+                       preserve_gid = 1;
                        break;
 
                case OPT_CHOWN: {
@@ -1785,6 +1787,7 @@ int parse_arguments(int *argc_p, const char ***argv_p)
                                if (asprintf(&usermap, "*:%.*s", len, chown) < 0)
                                        out_of_memory("parse_arguments");
                                usermap_via_chown = True;
+                               preserve_uid = 1;
                        }
                        if (arg && *arg) {
                                if (groupmap) {
@@ -1800,6 +1803,7 @@ int parse_arguments(int *argc_p, const char ***argv_p)
                                if (asprintf(&groupmap, "*:%s", arg) < 0)
                                        out_of_memory("parse_arguments");
                                groupmap_via_chown = True;
+                               preserve_gid = 1;
                        }
                        break;
                }
index 3de57b72a1fc431132ba23c9763ca331d1bbb6f4..d154a98ca5e2cfea98c3c14eef991e9783492fd2 100644 (file)
@@ -2638,6 +2638,9 @@ your home directory (remove the '=' for that).
     option to have any effect, the `-g` (`--group`) option must be used (or
     implied), and the receiver will need to have permissions to set that group.
 
+    The `--usermap` option implies the `--owner` option while the `--groupmap`
+    option implies the `--group` option.
+
     If your shell complains about the wildcards, use `--protect-args` (`-s`).
 
 0.  `--chown=USER:GROUP`
@@ -2650,8 +2653,10 @@ your home directory (remove the '=' for that).
     USER is empty, a leading colon must be supplied.
 
     If you specify "`--chown=foo:bar`", this is exactly the same as specifying
-    "`--usermap=*:foo --groupmap=*:bar`", only easier.  If your shell complains
-    about the wildcards, use `--protect-args` (`-s`).
+    "`--usermap=*:foo --groupmap=*:bar`", only easier (with the same implied
+    `--owner` and/or `--group` option).
+
+    If your shell complains about the wildcards, use `--protect-args` (`-s`).
 
 0.  `--timeout=SECONDS`