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

Accessing resource forks? #53

Open
MaddTheSane opened this issue Oct 29, 2023 · 7 comments
Open

Accessing resource forks? #53

MaddTheSane opened this issue Oct 29, 2023 · 7 comments

Comments

@MaddTheSane
Copy link

Is there any way to have the APFS driver to access resource forks?

Included is a zipped raw image of APFS of ResEdit, an old Mac OS (Classic) application that includes a resource fork (but no data fork as it was only a m68k app), a read-me with data-fork text in Mac Roman and \r newlines, and additional data in the resource fork.
ResEdit 2.1.3 2.img.zip

@eafer
Copy link
Member

eafer commented Oct 30, 2023

Internally, we have everything in place to read resource forks, because we need it to work with compressed files. The problem is that Linux doesn't have any standard interface to expose the forks to the user. The closest thing is extended attributes, but those are limited to 64k in size. How big is the fork you need to read? I haven't checked your image yet, but if it's less than 64k you could try getfattr.

@eafer
Copy link
Member

eafer commented Oct 30, 2023

I just checked, and the resource fork in the readme appears to be readable if you run:

getfattr --only-values -n osx.com.apple.ResourceFork About\ ResEdit\ 2.1.3

The ResEdit file can't be read though, because it's too big (670639 bytes apparently). There is no straightforward way to deal with this, I guess at some point I need to add a new ioctl to read forks, and then write some userland tool to work with them. I wished Linux didn't have this limitation on xattr sizes.

If this is something you really need right now, it wouldn't be hard to modify the code to read the resource forks instead of the data forks.

@MaddTheSane
Copy link
Author

Doing some research, it looks like the maximum size a resource fork can be is 16 MiB.
This was a source of minor consternation, as I noticed later that the resource fork on some data I recovered didn't save the resource forks. This is mainly due to my ignorance of how Linux handles extended attributes.

Sadly, I tried to wipe the drive I was recovering, only to stop once I was hitting write errors.

@eafer
Copy link
Member

eafer commented Oct 30, 2023

Doing some research, it looks like the maximum size a resource fork can be is 16 MiB.

There are actually much bigger resource forks in use for compressed files.

This was a source of minor consternation, as I noticed later that the resource fork on some data I recovered didn't save the resource forks. This is mainly due to my ignorance of how Linux handles extended attributes.

How were you recovering the data? Did you get no errors during the copy? That sounds bad.

Sadly, I tried to wipe the drive I was recovering, only to stop once I was hitting write errors.

I'm sorry to hear that. Do you still need help with something?

@MaddTheSane
Copy link
Author

MaddTheSane commented Oct 30, 2023

If there were errors during the copy, I didn't notice. As I said, I was recovering data from it (macOS wouldn't mount it anymore due to hardware failures).

Do you still need help with something?

More for future reference.

@johnothwolo
Copy link

johnothwolo commented Jan 3, 2024

@eafer HFS on linux has a way of accessing resource-forks that I think you could replicate. Check this stack-exchange answer.

@eafer
Copy link
Member

eafer commented Jan 3, 2024

Yes, that could be done, but it wouldn't have helped the reporter avoid data loss. The problem is that if we are not exposing the xattrs through the standard interface, I would expect rsync and the like to just ignore them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants