From owner-freebsd-bugs Wed Sep 26 7:50: 7 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 4AB4737B435 for ; Wed, 26 Sep 2001 07:50:02 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.4/8.11.4) id f8QEo2I51326; Wed, 26 Sep 2001 07:50:02 -0700 (PDT) (envelope-from gnats) Date: Wed, 26 Sep 2001 07:50:02 -0700 (PDT) Message-Id: <200109261450.f8QEo2I51326@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Bruce Evans Subject: Re: bin/30819: /bin/mv results in warnings when /bin/cp -p does not. Reply-To: Bruce Evans Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR bin/30819; it has been noted by GNATS. From: Bruce Evans To: Jeremy Chadwick Cc: 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