MacMetadata

From RdiffBackupWiki

Jump to: navigation, search

tly there are three pieces of metadata on Macintosh file systems: Here is an excerpt from a message by John Goerzen:


I am not an expert on Macs here, but here is what I believe is the case.

Yes, there are three pieces: creator, type, and resource fork. All three are used less frequently in OS X, but are still often found and have to be preserved.

The creator and type are both 4-byte fixed-length values that identify the type of file and application used to create it. My belief, though I'm not certain about this, is that Python on a Mac will add some extra fields to stat() to hold these values. These values are simply read and stored as strings.

The resource fork you're already aware of, and is read as a file pointer.

I am somewhat confused by all the different versions of Python available for a Mac. However, at http://www.python.org/doc/current/lib/os-file-dir.html, it says in the section on stat():

 On Mac OS systems, the following attributes may also be available:
 strsize, stcreator, st_type.

I suspect st_rsize is a count of the number of bytes in the resource fork. stcreator and sttype are, of course, the creator and type.

The macfs FSSpec object (http://www.python.org/doc/current/mac/fsspec-objects.html) seems to have functions to work with type and creator as well:

GetCreatorType()

Return the 4-character creator and type of the file.


SetCreatorType(creator, type)

Set the 4-character creator and type of the file.

There is also "Finder Info". I do not know if this is important to back up or not (any Mac users know?) Anyway, that module also has:

GetFInfo()

Return a FInfo object describing the finder info for the file.


SetFInfo(finfo)

Set the finder info for the file to the values given as finfo (an

FInfo object).

It seems to have things to do with icons and locations in folders.


So, does anyone with a Mac want to add these? It would probably be pretty easy; here is a list of steps:

  1. Make rpath.py's setdata() add creator and type to rpath.data dictionary.
  2. Add creator and type to the attributes that metadata.py saves/restores.
  3. Change copy_attribs() in rpath.py to write creator and type.
  4. Add test cases for these in metadatatest.py and rpathtest.py.

...assuming that resource forks and these other types are supported or not supported as a group. If this assumption is false, then we also need to add automatic tests for these types, and create some global variables to store whether these are active.


Now that we have our backup server back up from a HDD crash I am going to do some more work on the Mac support for rdiff-backup. Right when that happened I found the FSSpec module of python which gives (more "correct") access to the resource fork data as well as the creator/type Id's. I will also take a look at getting it to use a different method for storing the resource fork data, as parsing 1GB of metadata proved too slow. Testing for the presence of a working FSSpec (or the "mac" version of it) would also prove a better HFS test than the current method. (danielathdcnetdotorg)


0.13.4 now has these features. testing is required - can people please test and post results to the mailing list? dave

What is the status of this feature anyways? Does it handle all resourceforks? /ErikJohansson


I believe it handles all resource forks, creator type, etc.

Personal tools