Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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