Subject: Re: Re: mv(1) and signals
To: None <tech-userlevel@NetBSD.ORG>
From: Marco Trillo <marcotrillo@gmail.com>
List: tech-userlevel
Date: 10/18/2006 16:26:03
Hi,
On 10/18/06, Alan Barrett <apb@cequrux.com> wrote:
> On Wed, 18 Oct 2006, Arnaud Lacombe wrote:
> > On Tue, Oct 17, 2006 at 04:55:33PM -0400, jklowden@schemamania.org wrote:
> > > $ ps | grep mv 13718 p7 D      0:23.08
> > > mv -PRp dat /usr/users/home[...]
> > >
> > > Hmm.  Those aren't documented options, and I hadn't typed them.
> > >
> > there is no such 'P', 'R' or 'p' options in the code. Even the GNU mv
> > has no such option.
>
> Those are valid options for cp(1).  mv(1) execs _PATH_CP with argv[0] =
> "mv" around line 338 of src/bin/mv.c.

And in fact, the exact options that are be passed to cp(1) in this
situation are documented on the mv(1) manual page:

     [...]
     Should the rename(2) call fail because source and target are on different
     file systems, mv will remove the destination file, copy the source file
     to the destination, and then remove the source.  The effect is roughly
     equivalent to:

           rm -f destination_path && \
           cp -PRp source_file destination_path && \
           rm -rf source_file
    [...]

     -Marco