Filipus Klutiero wrote:
> Subject: cp does not copy directories by default

Are you requesting that cp be changed to yes copy directories by default?

Note that cp has never copied directories by default and therefore
cannot now after 40 years of current behavior be changed to do so.

> According to cp(1)'s manpage:
> 
> > cp - copy files and directories
> >SYNOPSIS
> > cp  [OPTION]... [-T] SOURCE DEST
> > cp  [OPTION]... SOURCE... DIRECTORY
> > cp  [OPTION]... -t DIRECTORY SOURCE...
> > Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.

All of those are correct, if terse.  I could see suggesting upstream
to add one additional line to make the synopsis more explicit.

       cp [OPTION]... [-T] SOURCE DEST
       cp [OPTION]... SOURCE... DIRECTORY
       cp [OPTION]... -t DIRECTORY SOURCE...
       cp [-R|-a|-r] [OPTION]... DIRECTORY... DIRECTORY

But to my reading though this:

       cp [-R|-a|-r] [OPTION]... DIRECTORY... DIRECTORY

Collapses into this:

       cp [OPTION]... SOURCE... DIRECTORY

Since [-R|-a|-r] are OPTION and DIRECTORY is SOURCE.  And therefore
seem redundant to me.

For the full documentation you would need to refer to the info pages.
The info page says this behavior more explicitly.

> However, cp has a very particular default behavior with regard to
> directories, which are not copied as the info documentation
> acknowledges:
>
> > By default, `cp' does not copy directories. However, the `-R',
> > `-a', and `-r' options cause `cp' to copy recursively by descending
> > into source directories and copying files to corresponding
> > destination directories.
>
> I am not sure if other file types are also treated specially, but at
> least these are not explicitely mentioned in the manpage.

The GNU Project designates the info pages as the full primary
documentation.  Many people do not like this but unless someone wants
to fork or rewrite all of the utilities that is the way it is
upstream.  The Coreutils project creates man pages as quick reference
documents so that they are not entirely missing.  It creates them from
the online --help output.

The challenge for the 'cp --help' online documentation is to keep them
short and concise yet accurately display the required information.
This is then turned into the man page.

Note here is the POSIX online documentation on the cp command.

  http://pubs.opengroup.org/onlinepubs/009695399/utilities/cp.html

> I would have thought this is an upstream bug, but I didn't manage to
> see how the upstream manpage reads
> ( 
> http://git.savannah.gnu.org/gitweb/?p=coreutils.git;a=blob;f=man/cp.x;h=b26225fc977e61c31bd5dda9b0d719a64601d528;hb=HEAD
>  ).

Sorry but I didn't understand what you were asking there.  That isn't
the man page.  That is just the title.

See this reference for the usage function starting at line 151.  This
is the source to the man page.

  http://git.savannah.gnu.org/gitweb/?p=coreutils.git;a=blob;f=src/cp.c;hb=HEAD

Bob

Attachment: signature.asc
Description: Digital signature

Reply via email to