Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F140948509
D50984.id54425.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D50984.id54425.diff
View Options
diff --git a/bin/cp/tests/cp_test.sh b/bin/cp/tests/cp_test.sh
--- a/bin/cp/tests/cp_test.sh
+++ b/bin/cp/tests/cp_test.sh
@@ -183,6 +183,7 @@
pflag_acls_body()
{
mkdir dir
+ ln -s dir lnk
echo "hello" >dir/file
if ! setfacl -m g:staff:D::allow dir ||
! setfacl -m g:staff:d::allow dir/file ; then
@@ -204,12 +205,21 @@
atf_check cp -rp dir dst4
atf_check -o match:"group:staff:-+D-+" getfacl dst4
atf_check -o match:"group:staff:-+d-+" getfacl dst4/file
+ # source is a link without -p
+ atf_check cp -r lnk dst5
+ atf_check -o not-match:"group:staff:-+D-+" getfacl dst5
+ atf_check -o not-match:"group:staff:-+d-+" getfacl dst5/file
+ # source is a link with -p
+ atf_check cp -rp lnk dst6
+ atf_check -o match:"group:staff:-+D-+" getfacl dst6
+ atf_check -o match:"group:staff:-+d-+" getfacl dst6/file
}
atf_test_case pflag_flags
pflag_flags_body()
{
mkdir dir
+ ln -s dir lnk
echo "hello" >dir/file
if ! chflags nodump dir ||
! chflags nodump dir/file ; then
@@ -231,6 +241,14 @@
atf_check cp -rp dir dst4
atf_check -o match:"nodump" stat -f%Sf dst4
atf_check -o match:"nodump" stat -f%Sf dst4/file
+ # source is a link without -p
+ atf_check cp -r lnk dst5
+ atf_check -o not-match:"nodump" stat -f%Sf dst5
+ atf_check -o not-match:"nodump" stat -f%Sf dst5/file
+ # source is a link with -p
+ atf_check cp -rp lnk dst6
+ atf_check -o match:"nodump" stat -f%Sf dst6
+ atf_check -o match:"nodump" stat -f%Sf dst6/file
}
recursive_link_setup()
diff --git a/bin/cp/utils.c b/bin/cp/utils.c
--- a/bin/cp/utils.c
+++ b/bin/cp/utils.c
@@ -458,7 +458,7 @@
{
int source_fd = -1, dest_fd = -1, ret;
- if ((source_fd = open(source_dir, O_PATH)) < 0) {
+ if ((source_fd = open(source_dir, O_DIRECTORY | O_RDONLY)) < 0) {
warn("%s: failed to copy ACLs", source_dir);
return (-1);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Dec 31, 12:06 AM (1 h, 46 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27396971
Default Alt Text
D50984.id54425.diff (1 KB)
Attached To
Mode
D50984: cp: Fix improper use of O_PATH.
Attached
Detach File
Event Timeline
Log In to Comment