Bug 168401

Summary: cpio -o -H ustar munges file modification times in created archive
Product: Red Hat Enterprise Linux 4 Reporter: DriveCam Video Systems <cmiller>
Component: cpioAssignee: Peter Vrabec <pvrabec>
Status: CLOSED ERRATA QA Contact: Brock Organ <borgan>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.0   
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: RHBA-2006-0305 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-04-19 18:59:44 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:
Bug Depends On:    
Bug Blocks: 187538    
Attachments:
Description Flags
patch to fix this problem none

Description DriveCam Video Systems 2005-09-15 18:59:05 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.10) Gecko/20050909 Red Hat/1.0.6-1.4.2 Firefox/1.0.6

Description of problem:
When I create an archive using "cpio -o -H ustar", the file modification times stored in the archive are incorrect.

Version-Release number of selected component (if applicable):
cpio-2.5-8.RHEL4

How reproducible:
Always

Steps to Reproduce:
Case 1:  touch test ; ls -l test ; echo "test" | cpio -o -H ustar > test.tar ; rm test ; cpio -i -m < test.tar ; ls -l test ; rm test test.tar

File modification times are incorrect.

Case 2:  touch test ; ls -l test ; echo "test" | cpio -o -H ustar > test.tar ; rm test ; tar -xf test.tar ; ls -l test ; rm test test.tar

File modification times are incorrect.

Case 3:  touch test ; ls -l test ; tar -cf test.tar test ; rm test ; cpio -i -m < test.tar ; ls -l test ; rm test test.tar

File modification times are correct.

Case 4:  touch test ; ls -l test ; tar -cf test.tar test ; rm test ; tar -xf test.tar ; ls -l test ; rm test test.tar

File modification times are correct.


The common thread across all cases is that when the archive is created with cpio, the times are wrong, but when the archive is created with tar, they are correct.

Actual Results:  Cases 1 and 2 produce:

-rw-rw-r--  1 chaz chaz 0 Sep 15 11:38 test
-rw-rw-r--  1 chaz chaz 0 Sep  6  1971 test

The second file time is clearly wrong.

Cases 3 and 4 produce the expected result, below.

Expected Results:  All cases should produce:

-rw-rw-r--  1 chaz chaz 0 Sep 15 11:39 test
-rw-rw-r--  1 chaz chaz 0 Sep 15 11:39 test

where the two times listed are identical.

Additional info:

Comment 1 DriveCam Video Systems 2005-09-16 03:05:00 UTC
Found a record of an apparently identical bug in the Debian bug report logs. 
Looks like they've released a fix.  Might be a good starting point.

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=238177



Comment 12 Red Hat Bugzilla 2006-04-19 18:59:44 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2006-0305.html