Bug 9306

Summary: cpio 1.25.0 doesn't preserve file ownership
Product: Busybox Reporter: Nik Soggia <busybox>
Component: OtherAssignee: unassigned
Status: RESOLVED FIXED    
Severity: major CC: busybox-cvs
Priority: P5    
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Host: Target:
Build:
Attachments: bugfix

Description Nik Soggia 2016-09-27 10:36:49 UTC
Created attachment 6731 [details]
bugfix

# touch 1 2 3
# chown 11:111 1
# chown 22:222 2
# chown 33:333 3
# echo -e '1\n2\n3' | cpio -o -H newc | busybox cpio -v -t
1 block
-rw-r--r-- 0/0         0 2016-09-27 00:00:00 1
-rw-r--r-- 0/0         0 2016-09-27 00:00:00 2
-rw-r--r-- 0/0         0 2016-09-27 00:00:00 3
1 blocks

correct output should be:

-rw-r--r-- 11/111         0 2016-09-27 00:00:00 1
-rw-r--r-- 22/222         0 2016-09-27 00:00:00 2
-rw-r--r-- 33/333         0 2016-09-27 00:00:00 3

struct archive_handle is memset with zeroes when created.
archive_handle->cpio__owner has to be initialized explicitly otherwise any file will be extracted (or listed) with owner=0 and group=0.
here is my proposed solution:
Comment 1 Denys Vlasenko 2016-10-12 18:58:21 UTC
Fixed in git, thanks!