The manual page for cp command states: > -P No symbolic links are followed. This is the default if the -R option is specified. and then later > The -H, -L and -P options are ignored unless the -R option is specified. However, it clearly works even without -R: touch /tmp/file ln -s /tmp/file /tmp/symlink cp -P /tmp/symlink /tmp/copy ... results in symlink /tmp/copy -> /tmp/file
This inconsistency has been introduced in commit cp: Make -P work without -R as per POSIX https://github.com/freebsd/freebsd-src/commit/97e13037915c22162f199461f56951793d669f57 So the note that -P is ignored unless -R is specified should be rephrased. Note that the following sentence follows: > In addition, these options override each other and the command's actions are determined by the last one specified. So maybe the following fix would work: > The -H and -L options are ignored unless the -R option is specified. > In addition, the options -H, -L and -P override each other and the > command's actions are determined by the last one specified. (Tested with `cp -P -H /tmp/symlink /tmp/copy`... it does not result in symlink.) See also: https://reviews.freebsd.org/D30012 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=199466
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=2c5fd7d9a7ed36cf15dd538d9533e7835c7f8555 commit 2c5fd7d9a7ed36cf15dd538d9533e7835c7f8555 Author: Kit Dallege <xaum.io@gmail.com> AuthorDate: 2026-03-27 04:25:44 +0000 Commit: Warner Losh <imp@FreeBSD.org> CommitDate: 2026-06-10 12:35:03 +0000 cp(1): fix -P documentation to reflect it works without -R Since commit 97e13037915c, the -P flag works without -R as required by POSIX. Update the man page to state that only -H and -L are ignored without -R, while -P can be used independently. PR: 289959 Signed-off-by: Kit Dallege <xaum.io@gmail.com> Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/2102 bin/cp/cp.1 | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
^Triage: since there is no way to set MFC flags for Manual Pages, there is nothing to do here but close this.