Bookmarks, APFS, and enduring file references

In my exploration of schemes in macOS which can provide more enduring file references than simple paths, I have reached the (working) conclusion that Apple is pushing app developers towards its Bookmarks, but leaving users and sysadmins with inodes. Although inodes clearly aren’t going away, command tools such as GetFileInfo are definitely endangered.

To look at the situation in more detail, on Sierra and High Sierra (and hopefully remaining compatible with El Capitan too), I have built a new version of Precize: 1.0b3, which is available from here: precize10b3
and in Downloads above.

This adds further information to the foot of the scrolling text box, which you can also now save to a text file using the Save command in the File menu. This information includes:

  • File attributes, as in the previous version, which include hex listing of all extended attributes;
  • The volfs path, as you would enter it into the command line; this includes the volume and file inode numbers ready to use;
  • The macOS Bookmark data for the file, given first as a hex dump between <>, then as text characters extracted from that, separated using «»;
  • The full path to the file supplied from the Bookmark, which should be the same as that seen in the Finder or Terminal.

Command line

One important change introduced by High Sierra and APFS is that inode numbers, on APFS at least, are now 64-bit rather than 32-bit. Not only that, but file inodes typically have 9 hex (10 decimal) digits, rather than 8 hex (9 decimal) in Sierra with HFS+. Anything which assumes that inode numbers are only 32-bit will therefore break once it encounters those used in High Sierra.

Curiously, the inode number for the boot disk is little changed. Typically, in Sierra it is around 16777224 (decimal, 0100 0008 hex), and in High Sierra with APFS around 16777220.

Bookmarks

These are opaque, but invariably start with the four characters book (hex 626f6f6b), and appear to be binary property lists in structure. Their contents differ from the binary data stored in SharedFileLists, but there are similar patterns in their contents suggesting common content. Bookmarks in Sierra 10.12.6 and 10.13.3 appear to be similar in structure and size, and may well be compatible, although I cannot think of a situation in which such compatibility would be useful.

Bookmarks look excellent, if somewhat overweight, for providing enduring file references to compiled software, but I am struggling to think of a good way to present them for command line use. They vary slightly in size, but are typically around 1 KB, and a mixture of text and binary data. They are not intended for use in a command shell, but as access to inodes and volfs becomes more limited it is hard to think of a better alternative.

I am open to suggestions.