mv: -n overrides -u

* NEWS: Mention these fixes.
* doc/coreutils.texi (cp invocation, mv invocation):
Mention that -n is silent, and that it overrides -u.
* src/cp.c, src/mv.c (main): -n overrides -u.
This commit is contained in:
Paul Eggert committed 2018-01-04 13:57:58 -08:00
1 parent 3f9b1b86b1
commit 7e244891b0
4 files changed
+22 -4

No files matched your search

+7
View File
@@ -2,6 +2,13 @@ GNU coreutils NEWS -*- outline -*-
* Noteworthy changes in release ?.? (????-??-??) [?]
** Bug fixes
'cp -n -u' and 'mv -n -u' now consistently ignore the -u option.
Previously, this option combination suffered from race conditions
that caused -u to sometimes override -n.
[bug introduced with coreutils-7.1]
* Noteworthy changes in release 8.29 (2017-12-27) [stable]
+9 -4
View File
@@ -8569,7 +8569,8 @@ a regular file in the destination tree.
@itemx --no-clobber
@opindex -n
@opindex --no-clobber
Do not overwrite an existing file. The @option{-n} option overrides a previous
Do not overwrite an existing file; silently do nothing instead.
This option overrides a previous
@option{-i} option. This option is mutually exclusive with @option{-b} or
@option{--backup} option.
@@ -8809,8 +8810,10 @@ the comparison is to the source timestamp truncated to the
resolutions of the destination file system and of the system calls
used to update timestamps; this avoids duplicate work if several
@samp{cp -pu} commands are executed with the same source and destination.
If @option{--preserve=links} is also specified (like with @samp{cp -au}
for example), that will take precedence. Consequently, depending on the
This option is ignored if the @option{-n} or @option{--no-clobber}
option is also specified.
Also, if @option{--preserve=links} is also specified (like with @samp{cp -au}
for example), that will take precedence; consequently, depending on the
order that files are processed from the source, newer files in the destination
may be replaced, to mirror hard links in the source.
@@ -9657,7 +9660,7 @@ If the response is not affirmative, the file is skipped.
@opindex -n
@opindex --no-clobber
@cindex prompts, omitting
Do not overwrite an existing file.
Do not overwrite an existing file; silently do nothing instead.
@mvOptsIfn
This option is mutually exclusive with @option{-b} or @option{--backup} option.
@@ -9673,6 +9676,8 @@ source timestamp truncated to the resolutions of the destination file
system and of the system calls used to update timestamps; this avoids
duplicate work if several @samp{mv -u} commands are executed with the
same source and destination.
This option is ignored if the @option{-n} or @option{--no-clobber}
option is also specified.
@item -v
@itemx --verbose
+3
View File
@@ -1145,6 +1145,9 @@ main (int argc, char **argv)
usage (EXIT_FAILURE);
}
if (x.interactive == I_ALWAYS_NO)
x.update = false;
if (make_backups && x.interactive == I_ALWAYS_NO)
{
error (0, 0,
+3
View File
@@ -459,6 +459,9 @@ main (int argc, char **argv)
quoteaf (file[n_files - 1]));
}
if (x.interactive == I_ALWAYS_NO)
x.update = false;
if (make_backups && x.interactive == I_ALWAYS_NO)
{
error (0, 0,