In Stebalien/xattr#41, I discovered a strange bug. The xattr crate allocates a buffer for the attribute by first calling Xgetxattr with an empty buffer first to get the total buffer size, and then calling it with the full buffer after. However, on macOS there is a bug with lgetxattr, where when an empty slice is passed in (as opposed to a null pointer), it returns an ERANGE error that we can't handle.
This is probably a macOS bug that we might want to work around in this crate. The workaround for this is to pass a null pointer into lgetxattr when an empty slice is passed in, like below:
https://github.com/Stebalien/xattr/blob/32735c53b6e183be44dfbe7780704be4f0d32e03/src/sys/linux_macos.rs#L103-L125