Bug 430835 - cpio -i | -p does not restaure the owner of directories
Summary: cpio -i | -p does not restaure the owner of directories
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: cpio
Version: 8
Hardware: x86_64
OS: Linux
low
high
Target Milestone: ---
Assignee: Radek Brich
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2008-01-30 00:52 UTC by Féliciano Matias
Modified: 2008-03-13 07:41 UTC (History)
0 users

Fixed In Version: 2.9-7.fc8
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2008-03-13 07:41:19 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Féliciano Matias 2008-01-30 00:52:14 UTC
Description of problem:
cpio -i does not restaure the owner of directories if archive are created with
"find ... -depth ... | cpio -o"

Version-Release number of selected component (if applicable):
cpio-2.9-5.fc8

Exemple :
[root@one test]# mkdir -p test/test
[root@one test]# touch test/file test/test/file
[root@one test]# chown -R apache:apache test
[root@one test]# find test -print0 | xargs -0 ls -l -d
drwxr-xr-x 3 apache apache 4096 jan 30 01:47 test
-rw-r--r-- 1 apache apache    0 jan 30 01:47 test/file
drwxr-xr-x 2 apache apache 4096 jan 30 01:47 test/test
-rw-r--r-- 1 apache apache    0 jan 30 01:47 test/test/file
[root@one test]# find test -depth -print0 | cpio -ov --null --format=newc -a >
test.cpio
test/test/file
test/test
test/file
test
2 blocks
[root@one test]# rm -r -f test
[root@one test]# cpio -iv -m -d < test.cpio 
test/test/file
test/test
test/file
test
2 blocks
[root@one test]# find test -print0 | xargs -0 ls -l -d
drwxr-xr-x 3 root   root   4096 jan 30 01:47 test
-rw-r--r-- 1 apache apache    0 jan 30 01:47 test/file
drwxr-xr-x 2 root   root   4096 jan 30 01:47 test/test
-rw-r--r-- 1 apache apache    0 jan 30 01:47 test/test/file
[root@one test]# 



Additional info:
Work fine if "find -depth" is not used.

Comment 1 Féliciano Matias 2008-01-30 01:18:11 UTC
It seems it's a serious security issue :
[root@one test]# mkdir -p test/test
[root@one test]# chown -R apache:apache test
[root@one test]# chmod -R 700 test
[root@one test]# find test -depth -print0 | cpio -pv --null -a -m -d tmp
tmp/test/test
tmp/test
0 blocks
[root@one test]# find tmp/ -print0 | xargs -0 ls -l -d
drwxr-xr-x 3 root   root   4096 jan 30 02:15 tmp/
drwxr-xr-x 3 root   root   4096 jan 30 02:15 tmp/test
drwx------ 2 apache apache 4096 jan 30 02:15 tmp/test/test
[root@one test]# 


tmp/test has 755 mode !
Should be 700.

Comment 2 Féliciano Matias 2008-02-10 01:04:03 UTC
Seems to be an old bug (30 Oct 2007):
http://lists.gnu.org/archive/html/bug-cpio/2007-10/msg00001.html

Is cpio supported by Fedora/Red Hat ?
If not, Fedora should remove the cpio package.

Comment 3 Radek Brich 2008-02-11 12:21:43 UTC
Hi, thanks for the report.

I can reproduce the bug, it appeared in upstream cpio 2.9 and cpio 2.8 seems to
be OK. Trying to find the change which causes this regression...

Comment 4 Fedora Update System 2008-02-19 10:47:32 UTC
cpio-2.9-6.fc8 has been submitted as an update for Fedora 8

Comment 5 Fedora Update System 2008-02-21 02:56:33 UTC
cpio-2.9-6.fc8 has been pushed to the Fedora 8 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update cpio'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F8/FEDORA-2008-1894

Comment 6 Féliciano Matias 2008-02-22 06:34:58 UTC
Bug in #c1 not fixed.
Exemple :
[root@one tmp]# rpm -q --queryformat "%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n" cpio
cpio-2.9-6.fc8.x86_64
[root@one tmp]# mkdir -p test/test
[root@one tmp]# chown -R apache:apache test
[root@one tmp]# chmod -R 700 test
[root@one tmp]# find test -depth -print0 | cpio -pv --null -a -m -d tmp
tmp/test/test
tmp/test
0 blocks
[root@one tmp]# find tmp/ -print0 | xargs -0 ls -l -d
drwxr-xr-x 3 root   root   4096 fév 22 07:30 tmp/
drwxr-xr-x 3 root   root   4096 fév 22 07:30 tmp/test  <===
drwx------ 2 apache apache 4096 fév 22 07:30 tmp/test/test
[root@one tmp]# rm -r -f *
[root@one tmp]# mkdir -p test/test
[root@one tmp]# chown -R apache:apache test
[root@one tmp]# find test -print0 | cpio -pv --null -a -m -d tmp
tmp/test
tmp/test/test
0 blocks
[root@one tmp]# find tmp/ -print0 | xargs -0 ls -l -d
drwxr-xr-x 3 root   root   4096 fév 22 07:30 tmp/
drwxr-xr-x 3 apache apache 4096 fév 22 07:30 tmp/test  <===
drwxr-xr-x 2 apache apache 4096 fév 22 07:30 tmp/test/test
[root@one tmp]# 


Should I change the bug status to FAILS_QA ?

Comment 7 Radek Brich 2008-02-22 10:59:34 UTC
Yes, thanks for noticing.
It seems I fixed just copyin mode, not copypass...
Will look on it little more.


Comment 8 Fedora Update System 2008-03-03 11:38:17 UTC
cpio-2.9-7.fc8 has been submitted as an update for Fedora 8

Comment 9 Radek Brich 2008-03-03 11:39:43 UTC
Ok, I reverted some bad-behaving code to cpio 2.8 state. This bug should be
resolved completely now.

Comment 10 Fedora Update System 2008-03-03 18:24:32 UTC
cpio-2.9-7.fc8 has been pushed to the Fedora 8 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update cpio'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F8/FEDORA-2008-2211

Comment 11 Féliciano Matias 2008-03-08 21:14:38 UTC
Seems OK.
Well done.
Tested with cpio-2.9-7.fc8.x86_64.

Comment 12 Fedora Update System 2008-03-13 07:41:17 UTC
cpio-2.9-7.fc8 has been pushed to the Fedora 8 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.