Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[macOS] Fix COPY step on macOS 15 Sequoia (#884)
macOS build fails on Sequoia beta 2 and later (verified in public beta 3 as well) hosts during COPY step when copying files with the `restricted` extended attribute set. The problem appears to be due to the `-a` (archive) option, which is an alias for `-RpP`. Of these, the `-p` option appears to be the source of the problem. This flag attempts to preserve file metadata including Access Control Lists and Extended Attributes. However, the `restricted` extended attribute is not settable when System Integrity Protection (SIP) is enabled, which it is by default. This appears to be a change in the implementation of `cp` in macOS 15 Sequoia beta 2 and later. Previous versions would fail to copy the attribute, but continue without failing. The current version appears to fail if it cannot set any extended attribute. Two alternatives to the previous `cp -af` step: * Use `cp -Rf`. This succeeds but file metadata such as creation time, modification time, etc. are not preserved. * Use `rsync -a`. rsync's -a flag also copies metadata but on a best-efforts basis and doesn't error out when it fails to set the restricted attribute. Of the two, the latter more closely approximates the previous behaviour. The `rm -rf` step can be replaced with `rsync`'s `--delete` option; with the default `--delete-before` behaviour, this replicates the function of the `rm -rf`. Fixes: flutter/flutter#152978 ## Pre-launch Checklist - [X] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [X] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [X] I read the [Flutter Style Guide] _recently_, and have followed its advice. - [X] I signed the [CLA]. - [X] I listed at least one issue that this PR fixes in the description above. - [X] I updated/added relevant documentation (doc comments with `///`). - [X] I added new tests to check the change I am making, or this PR is [test-exempt]. - [X] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/master/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/master/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/master/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/master/docs/contributing/Style-guide-for-Flutter-repo.md [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/master/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/master/docs/contributing/Chat.md
- Loading branch information