Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion delete.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions generator.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
10 changes: 5 additions & 5 deletions options.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down Expand Up @@ -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"
Expand All @@ -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
Expand Down
10 changes: 5 additions & 5 deletions rsync.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand All @@ -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`

Expand Down Expand Up @@ -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.
Expand Down
31 changes: 19 additions & 12 deletions testsuite/tests/metadata/fileflags.py
Original file line number Diff line number Diff line change
Expand Up @@ -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='',
Expand All @@ -42,27 +42,33 @@ 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')

if not native:
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
Expand All @@ -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:
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion usage.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 "
Expand Down
Loading