Actually, cp -H and -L aren't synonyms.

Rob Landley rob at landley.net
Sun Jan 3 12:04:53 UTC 2010


The busybox cp --help implies that -H and -L are synonyms:

	-H,-L	Dereference all symlinks (default)

This is not the case.  SUSv4 says:

  If the -R option was specified:

    If none of the options -H, -L, nor -P were specified, it is unspecified
    which of -H, -L, or -P will be used as a default.

    If the -H option was specified, cp shall take actions based on the type and
    contents of the file referenced by any symbolic link specified as a
    source_file operand.

    If the -L option was specified, cp shall take actions based on the type and
    contents of the file referenced by any symbolic link specified as a
    source_file operand or any symbolic links encountered during traversal of a
    file hierarchy.

    If the -P option was specified, cp shall copy any symbolic link specified as
    a source_file operand and any symbolic links encountered during traversal
    of a file hierarchy, and shall not follow any symbolic links.

From http://www.opengroup.org/onlinepubs/9699919799/utilities/cp.html

So -H means only dereference symlinks encountered on the command line, but 
don't dereference ones encountered when recursing down into subdirectories.  
But -L will dereference all of 'em, even the ones found down in the 
subdirectories.

Rob
-- 
Latency is more important than throughput. It's that simple. - Linus Torvalds


More information about the busybox mailing list