Mac Resource Fork inspector on Catalina

Wondering if anyone might noticed issues with the resource fork inspector?

What I’m seeing is if I read the size of the resource fork:

Q: size of resource fork of file "/tmp/Test.webloc"
A: 286
T: 58

Make a change to the resource fork (such as adding a file icon) and verify with:

xattr -p com.apple.ResourceFork /tmp/Test.webloc

And then re-read the size of the resource fork I get the same result:

Q: size of resource fork of file "/tmp/Test.webloc"
A: 286
T: 56

Found a bit of reading on the subject but haven’t done a deeper dive yet -

1 Like

I don’t know much about this subject in general.

I wonder if there could be caching of the info involved somehow?

Also, can there be more than one resource fork for a file?

Caching - No, I don’t believe so. The change is immedietely apparent in the Finder and with xattr.

Multiple - No, I believe each file can have a single resource fork.

Using something like cat /tmp/Test.webloc/..namedfork/rsrc | wc -l the change is occurring on disk:

% cat /tmp/Test.webloc/..namedfork/rsrc | wc -l
       0

And after…

% cat /tmp/Test.webloc/..namedfork/rsrc | wc -l
    3250

Unfortunately, not accessible from the file inspector -probably by design?

Q: exists file "/tmp/Test.webloc/..namedfork/rsrc"
A: False
T: 147
1 Like

Wow, I haven’t need to think about resource forks in a very long time.

I’m not certain that APFS in fact supports resource forks? I kinda think it stuffs them in the age-old AppleDouble format? Things like the Finder tag colors use resource forks, but very little else.

What in .webloc files is stuffed in a resource fork?

1 Like

Hm, I’m going to have to do a little more reading on AppleDouble format.

For .webloc files, I’m using xattr to hide the file extension with com.apple.FinderInfo and then set the file icon with NSWorkspace.shared.setIcon(). Both of these appear to modify the resource fork on disk and then I use relevance to verify the webloc URL dictionary is set and something like length of resource fork of it > 1000 to determine if the Finder properties were set successfully.

The result is a clean looking .webloc file that can be put on the Desktop, Dock or in the Applications folder.

I might be wrong about AppleDouble. But I think APFS, instead of supporting them as actual forks, puts them in extended attributes.

In any case, the behavior seems to have changed recently and I don’t know enough about what the inspector is doing to suggest how to fix it and the resulting length/size seems inconsistent with xattr or ..namedfork/rsrc.

Can you identify if the demarcation line is at OS version or file system?