Bug 15853 - 'cp' doesn't keep destination permissions
Summary: 'cp' doesn't keep destination permissions
Status: NEW
Alias: None
Product: Busybox
Classification: Unclassified
Component: Standard Compliance (show other bugs)
Version: unspecified
Hardware: All Linux
: P5 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-11-15 12:10 UTC by fulalas123
Modified: 2023-11-15 18:31 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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