cp: Make -P work without -R as per POSIX

According to POSIX, cp should allow the `-P` flag to work whether `-R`
is specified or not.  Currently, the `-P` option only works along with
`-R`.

PR:		199466
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D30012
This commit is contained in:
Cameron Katri
2022-02-23 12:55:13 -06:00
committed by Kyle Evans
parent ab7d095969
commit 97e1303791
3 changed files with 31 additions and 9 deletions
+11
View File
@@ -190,6 +190,16 @@ recursive_link_Lflag_body()
'(' ! -L foo-mirror/foo/baz ')'
}
atf_test_case standalone_Pflag
standalone_Pflag_body()
{
echo "foo" > bar
ln -s bar foo
atf_check cp -P foo baz
atf_check -o inline:'Symbolic Link\n' stat -f %SHT baz
}
atf_init_test_cases()
{
atf_add_test_case basic
@@ -202,4 +212,5 @@ atf_init_test_cases()
atf_add_test_case recursive_link_dflt
atf_add_test_case recursive_link_Hflag
atf_add_test_case recursive_link_Lflag
atf_add_test_case standalone_Pflag
}