Bug 15853

Summary: 'cp' doesn't keep destination permissions
Product: Busybox Reporter: fulalas123
Component: Standard ComplianceAssignee: unassigned
Status: NEW ---    
Severity: normal CC: busybox-cvs
Priority: P5    
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Host: Target:
Build:

Description fulalas123 2023-11-15 12:10:18 UTC
Issue: 'cp -rf' doesn't keep destination permissions.

How to replicate:
	1- have a 644 permission test.txt file in /etc/xdg/autostart
	2- have a 755 permission test.txt file in /tmp
	3- call busybox using: busybox cp -rf /tmp /etc/xdg/autostart/test.txt

Expected behavior: the new file copied should replace the original one and keep the original file permissions.

Current behavior: the new file copied replaces the original one but it also replaces its permission, and that's not the behavior of cp from coreutils (https://www.gnu.org/software/coreutils/).

I'm using busybox 1.36.1
Comment 1 fulalas123 2023-11-15 18:31:53 UTC
I tried but failed to edit the issue because there's a tiny error in the steps to replicate. Here it goes:

1- have a 644 permission test.txt file in /etc/xdg/autostart
2- have a 755 permission test.txt file in /tmp
3- call busybox using: busybox cp /tmp/test.txt /etc/xdg/autostart