Bug 430835 - cpio -i | -p does not restaure the owner of directories
cpio -i | -p does not restaure the owner of directories
Status: CLOSED CURRENTRELEASE
Product: Fedora
Classification: Fedora
Component: cpio (Show other bugs)
8
x86_64 Linux
low Severity high
: ---
: ---
Assigned To: Radek Brich
Fedora Extras Quality Assurance
: Regression
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-01-29 19:52 EST by Féliciano Matias
Modified: 2008-03-13 03:41 EDT (History)
0 users

See Also:
Fixed In Version: 2.9-7.fc8
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-03-13 03:41:19 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Féliciano Matias 2008-01-29 19:52:14 EST
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-29 20:18:11 EST
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-09 20:04:03 EST
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 07:21:43 EST
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 05:47:32 EST
cpio-2.9-6.fc8 has been submitted as an update for Fedora 8
Comment 5 Fedora Update System 2008-02-20 21:56:33 EST
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 01:34:58 EST
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 05:59:34 EST
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 06:38:17 EST
cpio-2.9-7.fc8 has been submitted as an update for Fedora 8
Comment 9 Radek Brich 2008-03-03 06:39:43 EST
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 13:24:32 EST
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 16:14:38 EST
Seems OK.
Well done.
Tested with cpio-2.9-7.fc8.x86_64.
Comment 12 Fedora Update System 2008-03-13 03:41:17 EDT
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.