diff --git a/NEWS.md b/NEWS.md index 7f12d70d7..71af2cf7c 100644 --- a/NEWS.md +++ b/NEWS.md @@ -4,7 +4,7 @@ - Add local FIFO transfers on supported Linux builds with `--stream-source`. Require an exact byte count and EOF before replacing a regular destination. -- Add `--fileflags` to preserve the native `nodump` flag on regular files and +- Add `--preserve-nodump` to preserve the native `nodump` flag on regular files and directories in local FreeBSD transfers. - Accept `TCP_CONGESTION=NAME` in socket options on supported Linux builds. Distinguish unknown names, unavailable options and malformed values. diff --git a/README.md b/README.md index 84b795497..47d72024a 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ local named pipe into a regular file. The writer must produce exactly `SIZE` bytes and close the pipe before rsync can publish the file. FreeBSD builds with descriptor-based file flag support can preserve the -`nodump` flag in local transfers with `--fileflags`. +`nodump` flag in local transfers with `--preserve-nodump`. For local transfers to an existing directory, `--compare-dest-per-dir` and `--copy-dest-per-dir` can use files in that tree as bases for missing regular diff --git a/SECURITY.md b/SECURITY.md index 31494bf8b..689347a21 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -59,7 +59,7 @@ Where the operating system supports them, rsync uses held directory descriptors Holding a directory descriptor does not pin every entry in that directory or provide a consistent snapshot of a tree being modified during a transfer. -The local FreeBSD `--fileflags` option changes only `nodump` through a checked file descriptor. It does not clear protection flags to replace or delete an object. The filesystem API replaces a complete flag word, so changes made by another process between inspection and update are not serialised with rsync. +The local FreeBSD `--preserve-nodump` option changes only `nodump` through a checked file descriptor. It does not clear protection flags to replace or delete an object. The filesystem API replaces a complete flag word, so changes made by another process between inspection and update are not serialised with rsync. Daemon authentication proves knowledge of a shared secret but does not encrypt the connection. Legacy clients can negotiate MD4 or MD5. Operators who require a strong digest should set `auth digest = sha256`; sensitive transfers should use SSH or verified TLS. diff --git a/delete.c b/delete.c index d506878f2..8b67d8904 100644 --- a/delete.c +++ b/delete.c @@ -95,7 +95,7 @@ static BOOL fileflags_allow_delete(const char *path) return True; errno = EPERM; } - rsyserr(FERROR_XFER, errno, "refusing to delete %s with --fileflags", full_fname(path)); + rsyserr(FERROR_XFER, errno, "refusing to delete %s with --preserve-nodump", full_fname(path)); return False; } #endif diff --git a/generator.c b/generator.c index 8ad43bbfc..25a6bb406 100644 --- a/generator.c +++ b/generator.c @@ -2230,7 +2230,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, if (preserve_fileflags && statret == 0 && stype != FT_DIR) { if (is_dir < 0) goto cleanup; - rprintf(FERROR_XFER, "--fileflags refuses to replace a non-directory with %s\n", + rprintf(FERROR_XFER, "--preserve-nodump refuses to replace a non-directory with %s\n", full_fname(fname)); goto skipping_dir_contents; } @@ -2585,7 +2585,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, } /* Do not remove the old entry before the receiver can set the staged flags. */ if (preserve_fileflags) { - rprintf(FERROR_XFER, "--fileflags refuses to replace a non-regular file with %s\n", + rprintf(FERROR_XFER, "--preserve-nodump refuses to replace a non-regular file with %s\n", full_fname(fname)); goto cleanup; } diff --git a/main.c b/main.c index 69f444427..62eaad487 100644 --- a/main.c +++ b/main.c @@ -1618,7 +1618,7 @@ static int start_client(int argc, char *argv[]) } if (preserve_fileflags && (!local_server || list_only)) { - rprintf(FERROR, "--fileflags is only supported for local transfers\n"); + rprintf(FERROR, "--preserve-nodump is only supported for local transfers\n"); exit_cleanup(RERR_SYNTAX); } diff --git a/options.c b/options.c index 6bcee00dc..9ab113b45 100644 --- a/options.c +++ b/options.c @@ -671,8 +671,8 @@ static struct poptOption long_options[] = { {"xattrs", 'X', POPT_ARG_NONE, 0, 'X', 0, 0 }, {"no-xattrs", 0, POPT_ARG_VAL, &preserve_xattrs, 0, 0, 0 }, {"no-X", 0, POPT_ARG_VAL, &preserve_xattrs, 0, 0, 0 }, - {"fileflags", 0, POPT_ARG_VAL, &preserve_fileflags, 1, 0, 0 }, - {"no-fileflags", 0, POPT_ARG_VAL, &preserve_fileflags, 0, 0, 0 }, + {"preserve-nodump", 0, POPT_ARG_VAL, &preserve_fileflags, 1, 0, 0 }, + {"no-preserve-nodump", 0, POPT_ARG_VAL, &preserve_fileflags, 0, 0, 0 }, {"times", 't', POPT_ARG_VAL, &preserve_mtimes, 1, 0, 0 }, {"no-times", 0, POPT_ARG_VAL, &preserve_mtimes, 0, 0, 0 }, {"no-t", 0, POPT_ARG_VAL, &preserve_mtimes, 0, 0, 0 }, @@ -2433,7 +2433,7 @@ int parse_arguments(int *argc_p, const char ***argv_p) if (preserve_fileflags) { #ifndef SUPPORT_FILEFLAGS - strlcpy(err_buf, "--fileflags is not supported by this build\n", sizeof err_buf); + strlcpy(err_buf, "--preserve-nodump is not supported by this build\n", sizeof err_buf); goto cleanup; #else const char *conflict = read_batch ? "--read-batch" @@ -2450,11 +2450,11 @@ int parse_arguments(int *argc_p, const char ***argv_p) : keep_dirlinks ? "--keep-dirlinks" : insecure_links ? "--insecure-links" : NULL; if (am_server || am_daemon) { - strlcpy(err_buf, "--fileflags is only supported for local transfers\n", sizeof err_buf); + strlcpy(err_buf, "--preserve-nodump is only supported for local transfers\n", sizeof err_buf); goto cleanup; } if (conflict) { - snprintf(err_buf, sizeof err_buf, "--fileflags cannot be combined with %s\n", conflict); + snprintf(err_buf, sizeof err_buf, "--preserve-nodump cannot be combined with %s\n", conflict); goto cleanup; } #endif diff --git a/rsync.1.md b/rsync.1.md index a04a5f7ed..b6c620ea5 100644 --- a/rsync.1.md +++ b/rsync.1.md @@ -575,7 +575,7 @@ has its own detailed description later in this manpage. --chmod-dest=CHMOD set backup permissions with --fake-super --acls, -A preserve ACLs (implies --perms) --xattrs, -X preserve extended attributes ---fileflags preserve FreeBSD nodump flags in local transfers +--preserve-nodump preserve the FreeBSD nodump flag in local transfers --owner, -o preserve owner (super-user only) --group, -g preserve group --devices preserve device files (super-user only) @@ -997,7 +997,7 @@ sign) if you want the local shell to expand it. This is equivalent to `-rlptgoD`. It is a quick way of saying you want recursion and want to preserve almost everything. Be aware that it does **not** include preserving ACLs (`-A`), xattrs (`-X`), atimes (`-U`), - creation times (`-N`), [`--fileflags`](#opt) or hard links (`-H`). + creation times (`-N`), [`--preserve-nodump`](#opt) or hard links (`-H`). The only exception to the above equivalence is when [`--files-from`](#opt) is specified, in which case [`-r`](#opt) is not implied. @@ -1769,7 +1769,7 @@ sign) if you want the local shell to expand it. those used by [`--fake-super`](#opt)) unless you repeat the option (e.g. `-XX`). This "copy all xattrs" mode cannot be used with [`--fake-super`](#opt). -0. `--fileflags` +0. `--preserve-nodump` Preserve the native FreeBSD `nodump` flag (`UF_NODUMP`) on regular files and directories. Other source flags are ignored. A flag-only update keeps @@ -1787,7 +1787,7 @@ sign) if you want the local shell to expand it. `--partial-dir`, `--delay-updates`, `--temp-dir`, `--compare-dest`, `--copy-dest`, `--link-dest`, `--hard-links`, `--fake-super`, `--copy-devices`, `--write-devices`, `--keep-dirlinks`, `--insecure-links` - or `--remote-option`. Disable it with `--no-fileflags`. + or `--remote-option`. Disable it with `--no-preserve-nodump`. 0. `--chmod=CHMOD` @@ -3732,7 +3732,7 @@ sign) if you want the local shell to expand it. changed value. Note that if you are sending files to an rsync prior to 3.0.1 (April 2008), this change flag will be present only for checksum-differing regular files. - In a local [`--fileflags`](#opt) transfer, `c` also reports a `nodump` + In a local [`--preserve-nodump`](#opt) transfer, `c` also reports a `nodump` difference on a regular file or directory. - A `s` means the size of a regular file is different and will be updated by the file transfer. diff --git a/testsuite/tests/metadata/fileflags.py b/testsuite/tests/metadata/fileflags.py index a28f60ab1..d5909b609 100644 --- a/testsuite/tests/metadata/fileflags.py +++ b/testsuite/tests/metadata/fileflags.py @@ -33,7 +33,7 @@ def _test(context: TestContext): target.write_text('old data\n', encoding='ascii') batch = context.scratch / 'batch' version = json.loads(run_rsync('-VV', capture_output=True).stdout) - native = version['capabilities'].get('fileflags', False) + native = version['capabilities']['preserve_nodump'] def refuse(options, *paths, diagnostic): result = subprocess.run(rsync_argv(*options, *map(str, paths)), input='', @@ -42,10 +42,15 @@ def refuse(options, *paths, diagnostic): assert target.read_text(encoding='ascii') == 'old data\n' assert not list(batch.parent.glob('batch*')) + for flag in ('--fileflags', '--no-fileflags'): + refuse([flag], source, target, diagnostic=f'{flag}: unknown option') + if not native: - refuse(['--fileflags'], source, target, diagnostic='--fileflags is not supported') + refuse(['--preserve-nodump'], source, target, + diagnostic='--preserve-nodump is not supported') - run_rsync('--fileflags', '--no-fileflags', '--ignore-times', str(source), str(target)) + run_rsync('--preserve-nodump', '--no-preserve-nodump', '--ignore-times', + str(source), str(target)) assert target.read_text(encoding='ascii') == 'new data\n' target.write_text('old data\n', encoding='ascii') @@ -53,16 +58,17 @@ def refuse(options, *paths, diagnostic): return for flag in ('--write-batch', '--only-write-batch'): - refuse(['--fileflags', f'{flag}={batch}'], source, target, diagnostic='batch') - refuse(['--fileflags', f'--read-batch={batch}'], target, diagnostic='batch') - refuse(['--server', '--fileflags'], '.', target, diagnostic='local transfers') - refuse(['--fileflags', '-e', '/no-such-remote-shell'], source, 'host:target', + refuse(['--preserve-nodump', f'{flag}={batch}'], source, target, diagnostic='batch') + refuse(['--preserve-nodump', f'--read-batch={batch}'], target, diagnostic='batch') + refuse(['--server', '--preserve-nodump'], '.', target, diagnostic='local transfers') + refuse(['--preserve-nodump', '-e', '/no-such-remote-shell'], source, 'host:target', diagnostic='local transfers') - refuse(['--fileflags'], 'host::module/record', target, diagnostic='local transfers') + refuse(['--preserve-nodump'], 'host::module/record', target, diagnostic='local transfers') for flag in ('--inplace', '--partial', '--delay-updates', '--backup', '--hard-links', - '--insecure-links', '-M--no-fileflags', f'--temp-dir={context.scratch}', + '--insecure-links', '-M--no-preserve-nodump', f'--temp-dir={context.scratch}', f'--link-dest={context.source}'): - refuse(['--fileflags', flag], source, target, diagnostic='--fileflags cannot be combined') + refuse(['--preserve-nodump', flag], source, target, + diagnostic='--preserve-nodump cannot be combined') nodump = stat.UF_NODUMP hidden = stat.UF_HIDDEN @@ -84,7 +90,7 @@ def refuse(options, *paths, diagnostic): if version['capabilities'].get(capability)] def transfer(*options, check=True): - return run_rsync('-a', '--fileflags', *options, f'{context.source}/', + return run_rsync('-a', '--preserve-nodump', *options, f'{context.source}/', f'{context.destination}/', check=check, capture_output=True) try: @@ -163,7 +169,8 @@ def transfer(*options, check=True): target.write_text('keep old data\n', encoding='ascii') baseline = target.stat() entries = sorted(path.name for path in context.destination.iterdir()) - result = subprocess.run(rsync_argv('--fileflags', '--ignore-times', str(source), str(target)), + result = subprocess.run(rsync_argv('--preserve-nodump', '--ignore-times', + str(source), str(target)), env={**os.environ, 'LD_PRELOAD': str(library)}, capture_output=True, text=True, timeout=10) assert result.returncode == 23 and 'failed to set file flags' in result.stderr, result.stderr diff --git a/usage.c b/usage.c index 3c5ca073f..90c20957b 100644 --- a/usage.c +++ b/usage.c @@ -137,7 +137,7 @@ static void print_info_flags(enum logcode f) #ifndef SUPPORT_FILEFLAGS "no " #endif - "fileflags", + "preserve-nodump", #ifdef RSYNC_USE_SECLUDED_ARGS "default "