mirror of
https://github.com/coreutils/coreutils.git
synced 2024-12-18 06:18:25 +08:00
cp: add --reflink=never to force standard copy mode
This mode is currently the default, but most if not all users of reflink-capable filesystems want --reflink=auto, which is often encapsulated into an alias. Adding --reflink=never allows overriding such an alias. * doc/coreutils.texi (cp invocation): Describe the new option. * src/cp.c: Support --reflink=never. * tests/cp/reflink-auto.sh: Add a test case. * NEWS: Mention the new feature.
This commit is contained in:
parent
668306ed86
commit
163df41d45
2
NEWS
2
NEWS
@ -50,6 +50,8 @@ GNU coreutils NEWS -*- outline -*-
|
||||
|
||||
** New features
|
||||
|
||||
cp --reflink now supports --reflink=never to enforce a standard copy.
|
||||
|
||||
env supports a new -v/--debug option to show verbose information about
|
||||
each processing step.
|
||||
|
||||
|
@ -8743,6 +8743,9 @@ then report the failure for each file and exit with a failure status.
|
||||
@item auto
|
||||
If the copy-on-write operation is not supported then fall back
|
||||
to the standard copy behavior.
|
||||
|
||||
@item never
|
||||
Disable copy-on-write operation and use the standard copy behavior.
|
||||
@end table
|
||||
|
||||
This option is overridden by the @option{--link}, @option{--symbolic-link}
|
||||
|
7
src/cp.c
7
src/cp.c
@ -96,11 +96,11 @@ ARGMATCH_VERIFY (sparse_type_string, sparse_type);
|
||||
|
||||
static char const *const reflink_type_string[] =
|
||||
{
|
||||
"auto", "always", NULL
|
||||
"auto", "always", "never", NULL
|
||||
};
|
||||
static enum Reflink_type const reflink_type[] =
|
||||
{
|
||||
REFLINK_AUTO, REFLINK_ALWAYS
|
||||
REFLINK_AUTO, REFLINK_ALWAYS, REFLINK_NEVER
|
||||
};
|
||||
ARGMATCH_VERIFY (reflink_type_string, reflink_type);
|
||||
|
||||
@ -235,10 +235,13 @@ corresponding DEST file is made sparse as well. That is the behavior\n\
|
||||
selected by --sparse=auto. Specify --sparse=always to create a sparse DEST\n\
|
||||
file whenever the SOURCE file contains a long enough sequence of zero bytes.\n\
|
||||
Use --sparse=never to inhibit creation of sparse files.\n\
|
||||
"), stdout);
|
||||
fputs (_("\
|
||||
\n\
|
||||
When --reflink[=always] is specified, perform a lightweight copy, where the\n\
|
||||
data blocks are copied only when modified. If this is not possible the copy\n\
|
||||
fails, or if --reflink=auto is specified, fall back to a standard copy.\n\
|
||||
Use --reflink=never to ensure a standard copy is performed.\n\
|
||||
"), stdout);
|
||||
emit_backup_suffix_note ();
|
||||
fputs (_("\
|
||||
|
@ -38,4 +38,8 @@ test -s b || fail=1
|
||||
cp --reflink=auto --sparse=always "$a_other" b || fail=1
|
||||
test -s b || fail=1
|
||||
|
||||
# --reflink=auto should be overridden by --reflink=never
|
||||
cp --reflink=auto --reflink=never "$a_other" b || fail=1
|
||||
test -s b || fail=1
|
||||
|
||||
Exit $fail
|
||||
|
Loading…
Reference in New Issue
Block a user