tar: Avoid error when file grows during copy #227

Merged
merged 1 commit into from Jul 29, 2016

Conversation

Projects
None yet
2 participants
Contributor

bz2 commented Jul 29, 2016

Fixes lp:1457575 at the utils/tar level.

The symptom being seen in juju is "archive/tar: write too long"
during backup. This comes from the log file that is being added
to the tar being appended to between the point the size is taken
from stat and put in the tar header, and io.Copy finishing.

Simply using io.CopyN instead limiting the size written to what
the header specifies is sufficient to avoid the issue.

(Review request: http://reviews.vapour.ws/r/5334/)

tar: Avoid error when file grows during copy
Fixes lp:1457575 at the utils/tar level for 1.25 branch.

The symptom being seen in juju is "archive/tar: write too long"
during backup. This comes from the log file that is being added
to the tar being appended to between the point the size is taken
from stat and put in the tar header, and io.Copy finishing.

Simply using io.CopyN instead limiting the size written to what
the header specifies is sufficient to avoid the issue.
Contributor

bz2 commented Jul 29, 2016

$$william_lgtm$$

Contributor

jujubot commented Jul 29, 2016

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju-utils

@jujubot jujubot merged commit 9e19645 into juju:1.25 Jul 29, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment