Bug 15186

Summary: Allow permissions to be preserved when running as non-root
Product: Busybox Reporter: taaparthur
Component: Standard ComplianceAssignee: unassigned
Status: NEW ---    
Severity: normal CC: busybox-cvs
Priority: P5    
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Host: Target:
Build:
Attachments: Patch to allow permissions to be preserved as non-root

Description taaparthur 2022-12-17 22:10:47 UTC
Created attachment 9421 [details]
Patch to allow permissions to be preserved as non-root

Previously we explicitly checked our uid and if it wasn't 0, set ARCHIVE_DONT_RESTORE_PERM flag. There wasn't a lot of info in the commit message and this seems like a bug. 

This commit effectively reverts ebad0294c9 and adds a test.

For my usecase, I built and tar-ed a package and wanted to untar it into a chroot as a non-root user. busybox tar removed the setuid bit so programs like `su` broke.