Hacker News new | ask | show | jobs
by dreamcompiler 3194 days ago
> Besides, the fact that a _file_ backup tool might need a near complete rewrite with a change of a file system should raise some eyebrows.

It appears you've never written file backup software for MacOS. I have, and it's anything but trivial to get all the edge cases right. There are half a dozen different schemes for metadata and you have to handle all of them. There are packages which are really directories. ACLs. Two different kinds of softlinks, plus hardlinks. Finder attributes. Hidden files and caches that usually don't matter, but sometimes do. Creation dates, which don't exist on [older versions of] linux. And legacy cruft like resource forks and file types, which some users still depend on. Spotlight comments (nee Finder comments). Tags. Special locks added by Time Machine. Weird new locks that even root can't penetrate. (You have to fail gracefully on those, as the author points out.)

It's a nightmare. Go write a complete file-level backup system or a transparent VM file-mirroring solution for HFS+ and get back to me. In the meantime, you'll just have to trust the original author when he says that Apple's seamless transition to APFS is astonishing.

1 comments

Incidentally, I did work on a backup program for Windows and Unix-ish OSes some years ago. There are indeed locked files, there are hardlinks, symlinks, junctions and other types of reparse points that will give HFS+ a run for its money, there are alternate streams, DACLs, SACLs, there is a monstrosity called volume shadow copying, there is a lack of support for created times on some file systems, times that are supported are truncated differently, some file names are not supported here, but supported there, etc. Lots and lots of cruft accumulated over past decades.

But it's not a nightmare. It's just a very large pile of mostly trivial stuff.

Also none of this should require a "complete rewrite" if you are to add support for yet another file system. Saying something like this means that either existing program is a bowl of spaghetti code _or_ that someone is being coy and exaggerates implied difficulties. Are you going to argue with that? Because that was the point you were commenting on.

I would have expected two things with the transition to APFS:

--Certain edge cases of HFS+ were no longer supported or would now be supported differently.

--The various special-case file-manipulation APIs in MacOS would have changed.

Both the above tend to happen to some extent with every major rev of MacOS and even some minor revs, and they necessitate substantial code changes. The fact that the old code still "just works" with the APFS change I find surprising.

I was initially planning on a complete rewrite in order to start supporting snapshots in a different way (by using the ones saved by APFS). Going into that was outside the scope of the article.