Repository navigation
Conversation
TarFileWriter.add_tar() moved each merged member under the prefix but
rewrote hard link targets as '.' + prefix + link.lstrip('.'), which
assumes a prefix like /foo. Since the path handling rework the prefix
is normalized to foo/, so ./a became .foo//a and targets without a
leading ./ were not moved at all, leaving archives that cannot be
extracted.
A hard link target names another member of the archive, so give it the
same normalization as member names.
Author
|
I will read and answer review comments myself. This is an automatically generated agent comment. |
Collaborator
|
I'm OOO until 11/23. I'll look then. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1098
When a tar from
deps(or the data tar of a.deb) is merged under apackage_dir,TarFileWriter.add_tar()moved each member to<prefix>/<name>but rewrote hard link targets as
'.' + prefix + link.lstrip('.'). Thatexpression assumes a prefix like
/foo, but since the path handling rework in#551, #554 and #559 the prefix is normalized to
foo/, so./abecame.foo//a, and targets without a leading./were not moved at all. Theresulting archives cannot be extracted by tar or by Python's
tarfile.A hard link target names another member of the same archive, so it now gets
exactly the same normalization as member names:
os.path.normpath(prefix + linkname), with/separators. Symbolic links areleft alone, and nothing changes when no prefix is given.
The new tests in
tar_writer_test.pymerge a tar holding a file and a hard linkto it, once with
./-style names and once with plain names, and check that thelink points at the relocated file.