Subject: Re: bug#8636: closed (Re: bug#8636: cp -x flag does not work)

From: Jim Meyering <[email-masked]>
Date: Thu, 15 Sep 2011 18:18:48 +0200

[email-masked] wrote:
> I would ask you again to reconsider your view on this issue  because it is
> irrational.
>
> you are claiming functionality that you do not provide (stay on one file
> system during a potentially recursive copy ) while allowing recursion into
> other file systems if they are mounted beneath the directory you are
> copying.
>
> why you think that this constitutes staying  on one filesystem eludes me.
>
> find does this correctly ( -xdev or -mount switches) and coreutil's cp and
> mv can and should too.
>
> thanks for all the great work on coreutils and other of your work. if i had
> programming skills, i would fix this myself and provide a patch, but i
> don't.

You used this command:

    cp -xvdpR /* /newdirectory

That tells cp explicitly to copy every top-level directory under /.
i.e., for each directory one level under /, cp copies it to
newdirectory, but without traversing into a directory residing
on a device different than the command-line-specified directory.
That is how cp -x is documented to work.

To get the behavior you want, run this command:

    cp -xvdpR / /newdirectory

(note there's no "*" here, as you surmised in
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8636#11
your use of the "*" wildcard is what caused problems)

I hope you see that there is nothing to reconsider
and that cp -x can do precisely what you want.