Date: Wed, 26 Sep 2001 07:50:02 -0700 (PDT) From: Bruce Evans <bde@zeta.org.au> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/30819: /bin/mv results in warnings when /bin/cp -p does not. Message-ID: <200109261450.f8QEo2I51326@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/30819; it has been noted by GNATS. From: Bruce Evans <bde@zeta.org.au> To: Jeremy Chadwick <jdc@best.net> Cc: <freebsd-gnats-submit@FreeBSD.ORG> Subject: Re: bin/30819: /bin/mv results in warnings when /bin/cp -p does not. Date: Thu, 27 Sep 2001 00:44:40 +1000 (EST) On Tue, 25 Sep 2001, Jeremy Chadwick wrote: > >Description: > >From mv(1): > > As the rename(2) call does not work across file systems, mv uses cp(1) > and rm(1) to accomplish the move. The effect is equivalent to: > > rm -f destination_path && \ > cp -pRP source_file destination && \ > rm -rf source_file This is a bug in the man page. mv across file systems is not quite equivalent to the above. In particular, mv is required to report all errors for duplicating file attributes, although such errors do not affect mv's exit status or the removal of the source file (POSIX spec). > >From cp(1): > > -p Cause cp to preserve in the copy as many of the modification time, > access time, file flags, file mode, user ID, and group ID as > allowed by permissions. > > If the user ID and group ID cannot be preserved, no error message > is displayed and the exit value is not altered. > > It seems to me the "warning" spit out by mv(1) is worthless, as cp(1) does not do this. cp -p is different from mv because it is normal for cp -p to be unable to preserve attributes, and cp -p doesn't destroy the original copies. mv always preserves attributes unless the move is across filesystems. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200109261450.f8QEo2I51326>