diff --git a/coreutils.orig/src/mv.c b/coreutils/src/mv.c index 0bcc1bb..47463a2 100644 --- a/coreutils.orig/src/mv.c +++ b/coreutils/src/mv.c @@ -46,7 +46,8 @@ non-character as a pseudo short option, starting with CHAR_MAX + 1. */ enum { - STRIP_TRAILING_SLASHES_OPTION = CHAR_MAX + 1 + STRIP_TRAILING_SLASHES_OPTION = CHAR_MAX + 1, + NO_PRESERVE_OWNERSHIP_OPTION = CHAR_MAX + 2 }; /* Remove any trailing slashes from each SOURCE argument. */ @@ -60,6 +61,7 @@ static struct option const long_options[] = {"interactive", no_argument, NULL, 'i'}, {"no-clobber", no_argument, NULL, 'n'}, {"no-target-directory", no_argument, NULL, 'T'}, + {"no-preserve-ownership", no_argument, NULL, NO_PRESERVE_OWNERSHIP_OPTION}, {"strip-trailing-slashes", no_argument, NULL, STRIP_TRAILING_SLASHES_OPTION}, {"suffix", required_argument, NULL, 'S'}, {"target-directory", required_argument, NULL, 't'}, @@ -317,6 +319,8 @@ If you specify more than one of -i, -f, -n, only the final one takes effect.\n\ -u, --update move only when the SOURCE file is newer\n\ than the destination file or when the\n\ destination file is missing\n\ + --no-preserve-ownership do not copy ownership information\n\ + when moving between file systems\n\ -v, --verbose explain what is being done\n\ -Z, --context set SELinux security context of destination\n\ file to default type\n\ @@ -432,6 +436,9 @@ main (int argc, char **argv) x.set_security_context = true; } break; + case NO_PRESERVE_OWNERSHIP_OPTION: + x.preserve_ownership = false; + break; case_GETOPT_HELP_CHAR; case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS); default: diff --git a/coreutils.orig/doc/coreutils.texi b/coreutils/doc/coreutils.texi index 51d96b4..da67a9a 100644 --- a/coreutils.orig/doc/coreutils.texi +++ b/coreutils/doc/coreutils.texi @@ -8988,6 +8988,10 @@ directory succeeded, but the second didn't, the first would be left on the destination partition and the second and third would be left on the original partition. +When moving between file systems, @command{mv} tries to copy ownership +information like @code{cp -p}. +This behaviour may be disabled by @option{--no-preserve-ownership} option. + @cindex extended attributes, xattr @command{mv} always tries to copy extended attributes (xattr), which may include SELinux context, ACLs or Capabilities. @@ -9047,6 +9051,11 @@ Do not overwrite an existing file. @mvOptsIfn This option is mutually exclusive with @option{-b} or @option{--backup} option. +@item --no-preserve-ownership +@opindex --no-preserve-ownership +@cindex ownership information, preserving +When moving between file systems, do not copy ownership information. + @item -u @itemx --update @opindex -u