|
From: | Eric Blake |
Subject: | Re: [Bug-tar] bug in 'file has changed as we read it' |
Date: | Thu, 09 Sep 2010 08:48:41 -0600 |
User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.8) Gecko/20100806 Fedora/3.1.2-1.fc13 Mnenhy/0.8.3 Thunderbird/3.1.2 |
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 address@hidden +1-801-349-2682 Libvirt virtualization library http://libvirt.org
[Prev in Thread] | Current Thread | [Next in Thread] |