Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 745408

Summary: Cpio behaves differently in RHEL5 and RHEL6 (--absolute-filenames parameter)
Product: Red Hat Enterprise Linux 6 Reporter: Petr Ruzicka <pruzicka>
Component: cpioAssignee: Ondrej Vasik <ovasik>
Status: CLOSED NOTABUG QA Contact: qe-baseos-daemons
Severity: medium Docs Contact:
Priority: medium    
Version: 6.1CC: mhomolov
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-10-12 12:11:00 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Petr Ruzicka 2011-10-12 09:47:19 UTC
*** Description of problem:
Cpio behaves differently in RHEL5 and RHEL6.

*** Version-Release number of selected component (if applicable):
# cpio --version
cpio (GNU cpio) 2.10

*** How reproducible:
See the steps below...


*** Steps to Reproduce:

1) mkdir -v /test
2) touch /test/{1,2,3}
3) find /test -print | cpio -ovc > /tmp/test.cpio
4) cpio -itvc < /tmp/test.cpio
drwxr-xr-x   2 root     root            0 Oct 12 11:34 /test
-rw-r--r--   1 root     root            0 Oct 12 11:34 /test/2
-rw-r--r--   1 root     root            0 Oct 12 11:34 /test/3
-rw-r--r--   1 root     root            0 Oct 12 11:34 /test/1  

5) mkdir -v /test2
6) cd /test2
7) cpio -ivcdm < /tmp/test.cpio
/test
cpio: /test/2 not created: newer or same age version exists
/test/2
cpio: /test/3 not created: newer or same age version exists
/test/3
cpio: /test/1 not created: newer or same age version exists
/test/1
2 blocks

8) ls -l
total 0

*** Actual results:

See the differences between RHEL5 and RHEL6 in these steps:

* RHEL5 (working wine):

4) cpio -itvc < /tmp/test.cpio
cpio: Removing leading `/' from member names
drwxr-xr-x   2 root     root            0 Oct 12 11:17 test
cpio: Removing leading `/' from member names
-rw-r--r--   1 root     root            0 Oct 12 11:17 test/1
cpio: Removing leading `/' from member names
-rw-r--r--   1 root     root            0 Oct 12 11:17 test/3
cpio: Removing leading `/' from member names
-rw-r--r--   1 root     root            0 Oct 12 11:17 test/2
2 blocks

7) cpio -ivcdm < /tmp/test.cpio
cpio -ivcdm < /tmp/test.cpio
cpio: Removing leading `/' from member names
test
cpio: Removing leading `/' from member names
test/1
cpio: Removing leading `/' from member names
test/3
cpio: Removing leading `/' from member names
test/2
2 blocks

8) ls -l
total 8
drwxr-xr-x 2 root root 4096 Oct 12 11:43 test

See the "bad" results in the same steps in RHEL6:

4) cpio -itvc < /tmp/test.cpio
cpio -itvc < /tmp/test.cpio
drwxr-xr-x   2 root     root            0 Oct 12 11:34 /test
-rw-r--r--   1 root     root            0 Oct 12 11:34 /test/2
-rw-r--r--   1 root     root            0 Oct 12 11:34 /test/3
-rw-r--r--   1 root     root            0 Oct 12 11:34 /test/1
2 blocks
#-> See the '/' in front of every directory

7) cpio -ivcdm < /tmp/test.cpio
/test
cpio: /test/2 not created: newer or same age version exists
/test/2
cpio: /test/3 not created: newer or same age version exists
/test/3
cpio: /test/1 not created: newer or same age version exists
/test/1
2 blocks

8) ls -l
total 0

*** Expected results:

Both examples should give the same results (it should be the same as in RHEL5)

Additional info:

Looks like there are some differences between cpio version 2.6 and 2.10.

Comment 1 RHEL Program Management 2011-10-12 09:49:17 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated
in the current release, Red Hat is unfortunately unable to
address this request at this time. Red Hat invites you to
ask your support representative to propose this request, if
appropriate and relevant, in the next release of Red Hat
Enterprise Linux. If you would like it considered as an
exception in the current release, please ask your support
representative.

Comment 2 Ondrej Vasik 2011-10-12 12:11:00 UTC
It's quite common that the behaviour changes between the major versions of RHEL ... you could get the "/" stripping in 2.10 if you use --no-absolute-filenames cpio option.

In RHEL-5, the default upstream behaviour was changed by cpio-2.6-dirTraversal.patch - see https://bugzilla.redhat.com/show_bug.cgi?id=156314 . Upstream fixed the CAN-2005-1229 different way - and didn't changed the defaults - see thread in http://lists.gnu.org/archive/html/bug-cpio/2005-09/msg00006.html .

In fact - just the default changed - in RHEL-5 the default value was declared as int abs_paths_flag = false; , in RHEL-6 there is int no_abs_paths_flag = false;

Changing the defaults to probably more secure --no-absolute-filenames would mean divergency from upstream - so I would prefer to keep it as it is... closing NOTABUG.