Skip to content
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

Don't save mac metadata/extended attributes for brew bottle #15173

Merged
merged 2 commits into from Apr 12, 2023

Conversation

ywwry66
Copy link
Contributor

@ywwry66 ywwry66 commented Apr 7, 2023

This commit includes --no-mac-metadata --no-acls and --no-xattrs in default_tar_args for brew bottle command.

Although default_tar_args is only active when --only-json-tab is not passed, in which case we don't require reproducible bottles, it is nonetheless beneficial to "regularize" tarball creation. In particular, this resolves a sporadic brew tests --only=dev-cmd/bottle:20 failure (see
https://github.com/orgs/Homebrew/discussions/4376 and #14997).

Furthermore, with gnu tar, --no-acls and --no-xattrs are default flags. As for "mac metadata", although I couldn't find official documentation, this post (https://superuser.com/a/61188) shares some info:

  • Resource forks (resource forks have been extended attributes since 10.4)
    • Custom icons set in Finder and the images of Icon\r files
    • Metadata in PSD files
    • Objects stored in scpt files, AppleScript Editor window state, descriptions of scripts
  • Information about aliases (aliases stop working if extended attributes are removed)
  • Quarantine status or source URLs of files downloaded from the internet
  • Spotlight comments
  • Encoding of files saved with TextEdit
  • Caret position of files opened with TextMate
  • Skim notes

None of these is supposed to be in the bottle I believe.

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally?

Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!

Furthermore, with gnu tar, --no-acls and --no-xattrs are default flags.

If they are default: any need to add them here?

Library/Homebrew/dev-cmd/bottle.rb Outdated Show resolved Hide resolved
Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

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

Great work, almost there!

Library/Homebrew/dev-cmd/bottle.rb Outdated Show resolved Hide resolved
Comment on lines +7 to +8
# Without --only-json-tab bottles are never reproducible
return ["tar", tar_args].freeze unless args.only_json_tab?
Copy link
Member

Choose a reason for hiding this comment

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

Would be nice to share this with generic if possible. Not sure if it is though 🤔. Feel free to leave it!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is possible, but I end up with more lines of code and more complicated logic so I guess it is better to leave as is.

This commit includes `--no-mac-metadata` `--no-acls` and `--no-xattrs`
in `default_tar_args` for `brew bottle` command.

Although `default_tar_args` is only active when `--only-json-tab` is
not passed, in which case we don't require reproducible bottles, it is
nonetheless beneficial to "regularize" tarball creation. In
particular, this resolves a sporadic `brew tests
--only=dev-cmd/bottle:20` failure (see
https://github.com/orgs/Homebrew/discussions/4376 and
Homebrew#14997).

Furthermore, with `gnu tar`, `--no-acls` and `--no-xattrs` are default
flags. As for "mac metadata", although I couldn't find official
documentation, this post (https://superuser.com/a/61188) shares some
info:
- Resource forks (resource forks have been extended attributes since 10.4)
  - Custom icons set in Finder and the images of Icon\r files
  - Metadata in PSD files
  - Objects stored in scpt files, AppleScript Editor window state, descriptions of scripts
- Information about aliases (aliases stop working if extended attributes are removed)
- Quarantine status or source URLs of files downloaded from the internet
- Spotlight comments
- Encoding of files saved with TextEdit
- Caret position of files opened with TextMate
- Skim notes

None of these is supposed to be in the bottle I believe.
@MikeMcQuaid
Copy link
Member

Thanks again @ywwry66, great work!

@ywwry66
Copy link
Contributor Author

ywwry66 commented Apr 11, 2023

Test failure is irrelevant.

@MikeMcQuaid MikeMcQuaid merged commit 0d749b5 into Homebrew:master Apr 12, 2023
22 checks passed
@ywwry66 ywwry66 deleted the fix-brew-tests-tar branch April 12, 2023 13:57
@github-actions github-actions bot added the outdated PR was locked due to age label May 13, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated PR was locked due to age
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants