From 7956070f2bf8a368d702021082b2621f89477fb7 Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Tue, 19 Oct 2021 21:01:58 -0700 Subject: [PATCH] Make --chown|--usermap|--groupmap imply -o|-g (as appropriate). --- options.c | 4 ++++ rsync.1.md | 9 +++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/options.c b/options.c index d1d540f3..3f035462 100644 --- 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; } diff --git a/rsync.1.md b/rsync.1.md index 3de57b72..d154a98c 100644 --- a/rsync.1.md +++ b/rsync.1.md @@ -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` -- 2.34.1