[clang] [clang-tools-extra] [llvm] `cp -r` replaces symlinks, update to `cp -R` (PR #201463)
Ian Anderson via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 3 15:49:57 PDT 2026
ian-twilightcoder wrote:
References:
https://pubs.opengroup.org/onlinepubs/9799919799/utilities/cp.html
There is no defined behavior for symlinks when `-R` is specified by itself. Suggests that `-r` doesn't do what one would expect.
https://man.freebsd.org/cgi/man.cgi?query=cp&manpath=FreeBSD+16.0-CURRENT
https://man.freebsd.org/cgi/man.cgi?query=cp&manpath=macOS+26.4
Documents that `-P` is the default for `-R`. Specifies that `-r` is equivalent to `-RL`. `-RH` is chosen to replace `-r` because it preserves the behavior of following the symlink on the command line, but does not replace any symlinks inside the specified directory. This preserves the internal structure in Apple bundles, i.e. the Test.framework/Headers symlink is preserved to point at Versions/Current/Headers instead of being replaced with a redundant copy of the headers.
https://github.com/llvm/llvm-project/pull/201463
More information about the cfe-commits
mailing list