On Debian, you also end up with a directory structure consisting of
one new 'foo' directory within the original 'foo' directory, which is
contradicting the message about not being able to copy foo into
itself...

$ mkdir foo
$ touch foo/bar
$ cp -R foo foo
cp: cannot copy a directory, `foo', into itself, `foo/foo'
$ ls -lR foo
foo:
total 4
-rw-r--r-- 1 ak ak    0 2007-10-19 11:14 bar
drwxr-xr-x 2 ak ak 4096 2007-10-19 11:14 foo

foo/foo:
total 0
-rw-r--r-- 1 ak ak 0 2007-10-19 11:14 bar


According to SUSv3, the cp utility *may* issue a diagnostic message
when the source and target arguments are the same. IMHO we're doing
the right thing with regards to that part. I'm not sure about
recursively creating a very deep directory structure, but it's not a
problem really.

Andreas

On 19/10/2007, Pau Amaro-Seoane <[EMAIL PROTECTED]> wrote:
> penguin's behaviour:
>
> elachistos| cp -R foo foo
> cp: cannot copy a directory, `foo', into itself, `foo/foo'
>
> :)
>
> 2007/10/19, Arnaud Berthomier <[EMAIL PROTECTED]>:
> > On the October 17, at 10:39 (-0700), Bryan Irvine wrote:
> > > [...]
> > > looks like a feature to me.  ;)
> >
> > Agreed, although it does not seem to exists on GNU/Linux since GNU's cp
> > is different from BSD's.  The feature is present on {Net,Open,Free}BSD.
> >
> > It's not that a big deal, is it?  Eventually, the question could be: what
> > should be limiting cp there?  a max_path value, or... himself? I think
> > the former's the best.
> >
> > Just my 2 cents. :)
> >
> > --
> > B+ A nation is a society united by a delusion about it's ancestry and by
> >   common hatred of its neighbours. B;            -- Dean William R. Inge
>
>


-- 
Andreas Kahari
Somewhere in the general Cambridge area, UK

Reply via email to