On 09/09/2010 01:27 AM, Michal Svoboda wrote:
When a hardlink to a file is created while tar is processing it, tar
will bail out with 'file has changed as we read it' even if the file did
not in fact change. The attached shell script has a pretty good chance
of demonstrating the bug.
I think the problem is that creating hardlinks updates ctime on the
inode which fools tar into believing that the file has changed. But that
new hardlink does not go into the archive so for all purposes it should
be outside of the what-tar-cares-about domain.
_Any_ update to ctime means that at least file metadata has changed.
Adding a hard link only changed the link count, but other changes
include modifying timestamps, ownerships, permissions, or file contents.
It would require tar to stat() a file both before and after the ctime
modification, and comparing those two stat structures, to rule which
changes might be safe to ignore; it is much simpler and less
memory-intensive to base the error solely off of whether ctime changed
than off of whether the stat contents changed.
--
Eric Blake [email protected] +1-801-349-2682
Libvirt virtualization library http://libvirt.org