Skip to content

When pkg_tar.prefix_dir == base of symlink path, don't double-dip.#749

Merged
aiuto merged 21 commits intobazelbuild:mainfrom
aiuto:tar_symlink_dup
Oct 16, 2023
Merged

When pkg_tar.prefix_dir == base of symlink path, don't double-dip.#749
aiuto merged 21 commits intobazelbuild:mainfrom
aiuto:tar_symlink_dup

Conversation

@aiuto
Copy link
Copy Markdown
Collaborator

@aiuto aiuto commented Sep 1, 2023

Correct for case where tar has prefix_dir and files/symlinks, but the user has already mapped the prefix_dir into those paths. Under the old behavior, prefix_dir was (incorrectly) not added to symlinks, so some users made the desired prefix part of the link. Protecting them against the double inclusion of the prefix is not strictly pedantic, but is the least surprising behavior, as their intent was most likely to get what the old behavior would have achived.

Add tests for this, which required improving verify_archive_test.

Along the way, it seems that tree artifacts with internal symlinks are a problem. This might be a bazel bug.
#750 is a reminder to look in to this some day.

user has already mapped the prefix_dir into those paths. Under the old
behavior, prefix_dir was (incorrectly) not added to symlinks, so some
users made the desired prefix part of the link.  Protecting them
against the double inclusion of the prefix is probably the least
surprising behavior.

Add tests for this, which required improving verify_archive_test.
@aiuto aiuto requested a review from sdtwigg September 1, 2023 20:46
@aiuto aiuto marked this pull request as ready for review September 3, 2023 02:10
@aiuto aiuto requested a review from alexeagle as a code owner September 3, 2023 02:10
@aiuto aiuto requested a review from jylinv0 as a code owner September 5, 2023 19:37
@aiuto aiuto requested a review from rbielak September 28, 2023 18:11
Copy link
Copy Markdown
Collaborator

@rbielak rbielak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@aiuto aiuto merged commit 006af3e into bazelbuild:main Oct 16, 2023
@aiuto aiuto deleted the tar_symlink_dup branch October 16, 2023 20:10
@coffinmatician
Copy link
Copy Markdown

Why is pkg_tar-files now labeled as "obsolete"? I use this feature very heavily, and would be curious what the replacement for it is (or what I should be doing instead of using pkg_tar-files)?

@aiuto
Copy link
Copy Markdown
Collaborator Author

aiuto commented Oct 25, 2023 via email

@coffinmatician
Copy link
Copy Markdown

coffinmatician commented Oct 25, 2023

That makes sense, thank you for helping me out. I'll try converting our internal usage to pkg_files in the near future and see how it goes.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants