Red Hat Bugzilla – Bug 500742
tar --atime-preserve errors with read-only source
Last modified: 2009-07-24 15:43:30 EDT
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
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. tar -cf /dev/null --atime-preserve narf
where narf is a file on a read-only filesystem.
tar: narf: Cannot utime: Read-only file system
tar: Error exit delayed from previous errors
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.
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.
tar-1.20-6.fc10 has been submitted as an update for Fedora 10.
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
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.