During a tar archiving operation with tar -cvf archive.tar source does the resulting tar archive that reports a file changed as we read it error still contain "some version" of the source file that it reported the error on or does it completely abandon archiving that source file and move on?


tar is for tape archive and it is stream based. tar can't go backward to erase what it has already written. So, that message is to tell you that what's in the archive may not be consistent as it changed while being written.

What happens is that for each file, tar writes a header that includes the path to the file, metadata (ownership, permission, time...) and the size (n bytes) and then proceeds to dump those n bytes by reading it from the file. If the size of the file changes while tar is dumping its content, tar can't go back and change the header to say, no after all the size was not n but p. All it can do is truncate the content to n bytes if p is greater than n or pad with zeros if it's smaller.

In both cases, you'll get an error message.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.