Bug 500742

Summary: tar --atime-preserve errors with read-only source
Product: [Fedora] Fedora Reporter: Bruce Jerrick <bmj001>
Component: tarAssignee: Ondrej Vasik <ovasik>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 10CC: kdudka, ovasik
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 1.20-6.fc10 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-07-24 19:43:30 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
Patch to ignore EROFS for source file on ro fs none

Description Bruce Jerrick 2009-05-13 21:19:39 UTC
Description of problem:
tar (tar-1.20-5.fc10) is a bit stupid about applying --atime-preserve to
  a source file on a read-only filesystem -- it tries utime() to reset the
  atime, and that fails.  Of course it isn't necessary on a read-only
  filesystem.

Version-Release number of selected component (if applicable):
tar-1.20-5.fc10

How reproducible:
100%

Steps to Reproduce:
1. tar -cf /dev/null --atime-preserve narf
where narf is a file on a read-only filesystem.
  
Actual results:
tar: narf: Cannot utime: Read-only file system
tar: Error exit delayed from previous errors

Expected results:
No errors

Additional info:
The easiest fix is probably to just let the utime() call determine if the
  file is on a read-only filesystem -- it has a return value EROFS just for
  that, which could then be ignored.  That may not be optimally efficient,
  but it would minimize race conditions.

Comment 1 Ondrej Vasik 2009-05-15 11:56:15 UTC
Created attachment 344123 [details]
Patch to ignore EROFS for source file on ro fs

Thanks for report... I guess ignoring EROFS for utime() calls in tar should not be done generally - just for that case of source file on read-only file system and --atime-preserve option. Attached patch should solve the issue, tar with this patch build in rawhide as tar-1.22-3.fc12 . I'll propose that patch upstream and make updates for lower Fedora's when accepted.

Comment 2 Fedora Update System 2009-07-10 08:54:27 UTC
tar-1.20-6.fc10 has been submitted as an update for Fedora 10.
http://admin.fedoraproject.org/updates/tar-1.20-6.fc10

Comment 3 Fedora Update System 2009-07-16 06:51:49 UTC
tar-1.20-6.fc10 has been pushed to the Fedora 10 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 tar'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F10/FEDORA-2009-7550

Comment 4 Fedora Update System 2009-07-24 19:43:25 UTC
tar-1.20-6.fc10 has been pushed to the Fedora 10 stable repository.  If problems still persist, please make note of it in this bug report.