Skip to content

Add workaround for macOS archive xattrs#2504

Merged
4 commits merged intomainfrom
jchadwick/macos-appledouble-junk
Oct 18, 2023
Merged

Add workaround for macOS archive xattrs#2504
4 commits merged intomainfrom
jchadwick/macos-appledouble-junk

Conversation

@ghost
Copy link

@ghost ghost commented Oct 17, 2023

This commit introduces a workaround for an issue with .tar archives created with libarchive on Darwin/macOS. When encountering a file that has extended attributes, such as the com.apple.provenance attribute, it will add a corresponding AppleDouble file with the prefix "._" in the same directory. Because these files have the same filename otherwise, the buf tool will see these when they correspond to proto files and subsequently fail to parse them as protobuf IDL.

Due to the fact that libarchive is used by default with the version of tar that ships with macOS, and the provenance extended attribute is set by macOS under many conditions when SIP is enabled, archives with these files are likely to occur on macOS.

.zip archives created by libarchive do not seem to have this issue. However, .zip archives created by Archive Utility.app have a very similar behavior when encountering extended attributes: it will place AppleDouble files in a separate directory tree under the MACOSX directory, but also with the "._" prefix. Since this can be handled by the same logic, this behavior is extended to ZIP files as well.

Closes #2387.

This commit introduces a workaround for an issue with .tar archives
created with libarchive on Darwin/macOS. When encountering a file that
has extended attributes, such as the com.apple.provenance attribute, it
will add a corresponding AppleDouble file with the prefix "._" in the
same directory. Because these files have the same filename otherwise,
the buf tool will see these when they correspond to proto files and
subsequently fail to parse them as protobuf IDL.

Due to the fact that libarchive is used by default with the version of
tar that ships with macOS, and the provenance extended attribute is set
by macOS under many conditions when SIP is enabled, archives with these
files are likely to occur on macOS.

.zip archives created by libarchive do not seem to have this issue.
However, .zip archives created by Archive Utility.app have a very
similar behavior when encountering extended attributes: it will place
AppleDouble files in a separate directory tree under the MACOSX
directory, but also with the "._" prefix. Since this can be handled by
the same logic, this behavior is extended to ZIP files as well.

Closes #2387.
@ghost ghost requested a review from bufdev October 17, 2023 17:48
Copy link
Member

@bufdev bufdev left a comment

Choose a reason for hiding this comment

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

Add a changelog entry as well

@ghost ghost merged commit df619b4 into main Oct 18, 2023
@ghost ghost deleted the jchadwick/macos-appledouble-junk branch October 18, 2023 01:45
This pull request was closed.
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.

buf build xyz.tar fails if a file in this archive has an extended attribute

1 participant