[release-1.59] pkg/archive.tarWriter.addFile(): don't change hardlink… #2359
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.
… targets
When examining a file that we're adding to an archive to see if it's hard linked to another file that's already been written, or to one that might be written later, only set an entry in the inode->name map that points to the entry we're writing for the first file. This keeps us from writing tar headers with Typeflag==TypeLink and a Linkname that points to another entry with Typeflag==TypeLink in cases where the inode has more than two names.
Addresses: containers/buildah#6297 for the release-1.59 branch and eventualy Buildah v1.41.* and Podman v5.6.*
Cherry-pick of #2357