-
Notifications
You must be signed in to change notification settings - Fork 286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
buf build xyz.tar fails if a file in this archive has an extended attribute #2387
Comments
Can you see if |
Both |
Some more information: adding a print statement in storageArchive.Untar shows that during
and during
This isn't surprising, given we have seen the error messages: It turns out that the Some options:
|
The macos Archive Utility.app does something similar when creating ZIP archives: $ unzip -l proto.zip
Archive: proto.zip
Length Date Time Name
--------- ---------- ----- ----
0 10-17-2023 17:50 proto/
4 10-17-2023 17:50 proto/x.proto
327 10-17-2023 17:50 __MACOSX/proto/._x.proto
--------- -------
331 3 files |
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. This workaround is not needed by .zip as libarchive .zip files do not seem to have the same behavior. Closes #2387.
Hmm, that's interesting. I didn't catch that behavior with libarchive ZIP, unless I was missing an option. Maybe it should be a separate issue... edit: Though, the same workaround works for both, so it's tempting to just make this behavior happen for all archives. |
I remember making both a |
The macos Archive Utility.app creates these files. To reproduce, right click a directory with proto files in the Finder, select "Compress", and run
That's my thinking as well, and why I commented 🙂 |
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.
Files created in vscode, and potentially other apps, have an extended attribute. Making a tape archive (
.tar
) and invokebuf build
on such an archive will fail.Steps to reproduce:
Run the following in the terminal built in to mac (not the one from vscode)
Verified on
1.22.0
and1.26.2-dev
(latest main).The text was updated successfully, but these errors were encountered: