Closed RJVB closed 6 months ago
Thanks for bringing this up, I had forgotten about this feature. Unfortunately it relies on extended attributes behind the scenes, which hfsfuse doesn't support (it surfaces some information via xattrs, but can't read extended attributes themselves from the filesystem.)
The trouble with those is just that their structure isn't documented anywhere that I could find and so will need to be reverse engineered. If they are implemented in the future I'll keep this in mind, it would be nice to support it.
On Wednesday December 13 2023 18:19:33 tab wrote:
Thanks for bringing this up, I had forgotten about this feature. Unfortunately it relies on extended attributes behind the scenes, which hfsfuse doesn't support (it surfaces some information via xattrs, but can't read extended attributes themselves from the filesystem.)
I suppose you can get at an attribute called something like user.com.apple.decmpfs
which contains the compressed contents if it's small enough but not at the resource fork component that contains the compressed chunk lists if to big to store in an xattr?
The trouble with those is just that their structure isn't documented anywhere that I could find and so will need to be reverse engineered.
Supposing we're indeed talking about getting at the compressed content, can't https://github.com/apple-oss-distributions/hfs be of any help, plus possibly the Mach kernel sources? Always useful to take a peak at https://opensource.apple.com/releases/ for this kind of thing ;)
For decompressing the content itself you could refer to my fork of afsctool (github.com/RJVB/afsctool) which preserves the old code to uncompress ZLIB-compressed files. I've not had a reason yet to extend this to decompressing the other flavours but it shouldn't be too hard to do that. After all I managed to generate them :)
can't https://github.com/apple-oss-distributions/hfs be of any help, plus possibly the Mach kernel sources?
It'd be simpler if that were the case. Apple's source license isn't BSD compatible, so an implementation of this for hfsfuse wouldn't be able to use their driver's code as a direct reference. Similar for the Linux driver and darling-dmg.
It looks like darling-dmg does implement compression however so may work for your use case.
It'd be simpler if that were the case. Apple's source license isn't BSD compatible, so an implementation of this for hfsfuse wouldn't be able to use their driver's code as a direct reference.
I didn't mean simple copy/paste, no ;)
I didn't know about darling-dmg so I'll have to take a look at that. All I want in the end is to be able to access hfs-compressed files from another Unix OS.
wouldn't be able to use their driver's code as a direct reference.
No need in any case. I took another look at the attributes file data and have it more or less figured out. I'll keep poking at it. Even if darling-dmg solves this feel free to leave this issue open as I would like hfsfuse to support it.
Great! Besides, I'd like to be able to mount disks without having to create DMGs first ;)
@RJVB I've pushed an experimental branch with support for compressed files and extended attributes in general here
It's only experimental insofar as I may still reorganize some things, but it's able to read all compressed files and xattrs identically to the native driver on my test volumes.
You will need zlib and lzfse installed to support those compression types (you may not have any LZFSE compressed files, in which case that library isn't needed.) If the Makefile is able to find these libraries you'll see
HAVE_LZFSE: yes
HAVE_ZLIB: yes
when building, and they will also appear in the output of hfsfuse -v
.
Feel free to try it and let me know if you run into any files it doesn't work with.
These changes have been merged (rather manually squashed) and a new release published: https://github.com/0x09/hfsfuse/releases/tag/0.199 This release includes support for reading arbitrary xattrs as well as for transparently reading HFS+ compressed files in addition to several other fixes, so I'll go ahead and close this.
Sounds promising, I'll have to go try that out!
Hi,
A quick search of the repo didn't turn up any suggestions that hfsfuse currently supports accessing hfs-compressed files. Are there plans to add that?