Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 26 Jan 2008 12:07:57 +1100 (EST)
From:      Bruce Evans <brde@optusnet.com.au>
To:        linimon@freebsd.org
Cc:        freebsd-bugs@freebsd.org
Subject:   Re: bin/1375: [patch] Extraneous warning from mv(1)
Message-ID:  <20080126114530.I60881@besplex.bde.org>
In-Reply-To: <200801260007.m0Q07gsd008266@freefall.freebsd.org>
References:  <200801260007.m0Q07gsd008266@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 26 Jan 2008 linimon@freebsd.org wrote:

> Synopsis: [patch] Extraneous warning from mv(1)

> Responsible-Changed-Why:
> One of our bugbusters claims that this has been fixed.  To submitter:
> can you confirm this?  Thanks.

I hope not, since the warning is correct.  mv's man page remains broken
and the missing warning for the directory case remain broken.

POSIX.1 has clearly specified that the warning is required (as I said
when the PR was submitted in 1996) since at least 2001.  From a 2001
draft:

%%%
25185                       If the duplication of the file characteristics fails for any reason, mv shall write a diagnostic
25186                       message to standard error, but this failure shall not cause mv to modify its exit status.
%%%

(The warning is for failure to duplicate ownerships).

mv.1 remains broken in its claim that mv across file systems is equivalent
to cp -pRP plus a few things.  Using cp -pRP gives the cases that are
claimed to work in the (but are actually broken) -- mv handles the case
of copying a single file internally, and does what is required by POSIX,
but for directories it invokes cp -pRP, but cp -pRP has slightly wrong
semantics for mv.  dds@ has done some work towards having a cp mode that
does the right things for mv, but this has not been committed AFAIK.
One obvious inconsistency with the above requirement of POSIX is that
cp writes the diagnostic for a chown() failure iff it considers the failure
to be fatal.  This is when chown() fails with errno != EPERM.  This alone
gives the following brokenness:
- if chown() fails with errno EPERM, then the diagnostic is missing but cp's
   and thus mv's exit status is not affected
- if chown() fails with errno != EPERM, then the diagnostic isn't missing
   but cp exits with a nonzero status, and mv has no way of distinguishing
   this from a failure to duplicate data.  In practice, mv just treats
   all errors from cp as fatal.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080126114530.I60881>