From owner-cvs-all@FreeBSD.ORG Sun Dec 16 14:14:31 2007 Return-Path: Delivered-To: cvs-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A9A0D16A46C; Sun, 16 Dec 2007 14:14:31 +0000 (UTC) (envelope-from dds@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 7478D13C458; Sun, 16 Dec 2007 14:14:31 +0000 (UTC) (envelope-from dds@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id lBGEEV9M050573; Sun, 16 Dec 2007 14:14:31 GMT (envelope-from dds@repoman.freebsd.org) Received: (from dds@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id lBGEEV3O050572; Sun, 16 Dec 2007 14:14:31 GMT (envelope-from dds) Message-Id: <200712161414.lBGEEV3O050572@repoman.freebsd.org> From: Diomidis Spinellis Date: Sun, 16 Dec 2007 14:14:31 +0000 (UTC) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: HEAD Cc: Subject: cvs commit: src/bin/mv mv.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Dec 2007 14:14:31 -0000 dds 2007-12-16 14:14:31 UTC FreeBSD src repository Modified files: bin/mv mv.c Log: When moving a directory across devices to a place where a directory with the same name exists, delete that directory first, before performing the copy. This ensures that mv(1) across devices follows the semantics of rename(2), as required by POSIX. This change could introduce the potential of data loss, even if the copy fails, violating the atomicity properties of rename(2). This is (mostly) mitigated by first renaming the destination and obliterating it only after a succesfull copy. The above logic also led to the introduction of code that will cleanup the results of a partial copy, if a cross-device copy fails. PR: bin/118367 MFC after: 1 month Revision Changes Path 1.47 +83 -23 src/bin/mv/mv.c