keeps one SQLite connection open while its process is alive.
Don't do that.
More specifically, can an existing open file descriptor or SQLite connection continue to reference an old filesystem object while a later lookup of the same Application Support path resolves to a restored or replacement object?
You're well into "undefined" territory there. I'm certain that no such guarantees exist, and if they did, they should be dismissed out of hand.
lifecycle invariant prevents it?
Apple never documents system behaviour at that level, and if they did, you can guarantee it would be wrong.
Does NSFileCoordinator participate when platform services restore private Application Support files?
Obviously you couldn't use NSFileCoordinator on a file that you never close. That should be a big hint.
SQLite also documents risks when an open database file is renamed or unlinked.
risks
I am not treating a raw rename or unlink test as equivalent to an Apple restore. I am explicitly excluding arbitrary unlink, rename, overwrite, or other direct same-container filesystem attacks. My question is only whether Apple's supported restore and container services can create an equivalent old-open-object versus newly-resolved-path condition while the same app process survives.
Seems like you're going about this the wrong way. You should focus on arbitrary unlink, rename, and overwrites. Detect those conditions and gracefully recover. You can get started on this today and test it.
Apple isn't going to tell you anything about how the system works. If they did, it would likely be obsolete in a matter of weeks.
Topic:
App & System Services
SubTopic:
Core OS
Tags: