From: Pádraig Brady
Date: Wed, 8 Jul 2026 17:55:34 +0000 (+0100) Subject: doc: fix description of mv -n X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=53926ba7d87e298ba8361681d29f6fefd256b082;p=thirdparty%2Fcoreutils.git doc: fix description of mv -n The description of mv --no-clobber got out of sync between commit v9.1-133-g7a69df889 and v9.4-134-g9907b6f5d * doc/coreutils.texi (mv invocation): Copy most of the -n description from the cp --no-clobber description. * src/mv.c (usage): Likewise. Note this explicitly deprectates the mv -n option as like cp the exit code varies across platforms. Solaris 11 was seen to silently fail, while Linux/FreeBSD succeed. Fixes https://bugs.gnu.org/81377 --- diff --git a/doc/coreutils.texi b/doc/coreutils.texi index 29baf57101..d3e3723c1c 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi @@ -8875,15 +8875,24 @@ to cause @command{cp} write to arbitrary target directories. @optItemx{cp,--link,} Make hard links instead of copies of non-directories. -@optItem{cp,-n,} -@optItemx{cp,--no-clobber,} +@macro noClobberOption{cmd} +@optItem{\cmd\,-n,} +@optItemx{\cmd\,--no-clobber,} +@cindex prompts, omitting Do not overwrite an existing file; silently skip instead. +@ifset MV_COMMAND +@mvOptsIfn +@end ifset +@ifclear MV_COMMAND This option overrides a previous @option{-i} option. +@end ifclear This option is mutually exclusive with @option{-b} or @option{--backup} option. This option is deprecated due to having a different exit status from other platforms. See also the @option{--update} option which will give more control over how to deal with existing files in the destination, and over the exit status in particular. +@end macro +@noClobberOption{cp} @optItem{cp,-p,} @optItemx{cp,--preserve,[=@var{attribute_list}]} @@ -10015,14 +10024,9 @@ Prompt whether to overwrite each existing destination file, regardless of its permissions, and fail if the response is not affirmative. @mvOptsIfn -@optItem{mv,-n,} -@optItemx{mv,--no-clobber,} -@cindex prompts, omitting -Do not overwrite an existing file; silently fail instead. -@mvOptsIfn -This option is mutually exclusive with @option{-b} or @option{--backup} option. -See also the @option{--update=none} option which will -skip existing files but not fail. +@set MV_COMMAND +@noClobberOption{mv} +@clear MV_COMMAND @optItem{mv,--no-copy,} @cindex renaming files without copying them diff --git a/src/mv.c b/src/mv.c index cd6aab473a..3ba6f701e4 100644 --- a/src/mv.c +++ b/src/mv.c @@ -288,7 +288,7 @@ Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY.\n\ ")); oputs (_("\ -n, --no-clobber\n\ - do not overwrite an existing file\n\ + (deprecated) silently skip existing files. See also --update\n\ ")); fputs (_("\ If you specify more than one of -i, -f, -n, only the final one takes effect.\n\