-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add support for extracting Apple Archives (.aar files) #2586
Conversation
Check `man aa` and https://developer.apple.com/documentation/applearchive for more details. This is an efficient Apple custom archive format available since versions of macOS 10.15. In macOS 10.15, this utility used to be called yaa.
@aonez @kornelski for potential curiosity. |
Seems reasonable, given that it's just shelling out to an Apple tool. If Apple uses it themselves for packages they hopefully pay attention to security of this decompressor. From what I could find it uses https://en.m.wikipedia.org/wiki/LZFSE so it's not the best compressing algorithm, but should be fast. |
It also supports LZMA and a couple more algorithms. From what I see it has a more favorable (or as favorable) decompression speed/compression size than other LZMA or LZFSE-competitive based archives. I think that is partly due to the multithreaded nature. Here's some random decompression timings on my M3 MBA running macOS 14.5 (compressing Arc.app, a ~776 MB app) using default parameters:
|
Nice one @zorgiepoo. Just thinking out loud, since AAR supports encryption maybe it can be implemented as well in a future upgrade, although I don't know if it will make much sense since the XML will need to provide the password and will be as public as the compressed file. Also ZSTD is a clear winner lately but for macOS only AAR is usually faster. |
I'm not a fan of supporting a decryption password, although we support it for DMGs because a couple of people wanted it some years ago (developers need to provide a password themselves via a delegate callback). So I'll hold off unless people want it (it also has steeper OS requirements). I may also later look into BinaryDelta performance as decompression is pretty single threaded and I think primarily bottlenecked there (followed after by bspatch). That might mean using multiple compression streams and splitting the payload into chunks. |
This is an efficient Apple archive format available since versions of macOS 10.15. From my testing it is much faster / compresses better than zip, tar.*, dmg (tried with lzma and lzfse compression).
In macOS 10.15, the aa utility used to be called yaa. (While older OS versions have
yaa
, they are not compatible with newly created archives).Check
man aa
and https://developer.apple.com/documentation/applearchive for more details.Like the other archive files we deal with, we are using the piped unarchiver. I didn't want to adopt Swift APIs in this framework and deal with those implications. (edit: seems like there is a C API too. I may explore that another day).
Misc Checklist
Testing
I tested and verified my change by using one or multiple of these methods:
Need to test:
aar
format.aar
aar
archive on macOS 10.14macOS version tested:
14.5 (23F79)
12.0 VM (works)
10.15.7 VM (works)
10.14.6 VM (fails)