About | Buy | Forum | Industry Watch | Learning Curve | Products | Search | Twitter | Xnews
Home » Learning Curve » Hotspots

A Document Being Saved on 10.4

Digging deeper. How far back does this behaviour go?


Buy It

Try It

Following up on yesterday's good tidings and today's good tidings it becomes incumbent to see how far back this or any similar behaviour goes.

The good news - which you already knew: 10.4 and earlier don't wreak havoc with your file system in quite the same way.

The not so good news: there are still any number of 'logical bombs' in the document controller code which can have wreaked havoc on any number of Tiger (or earlier) systems.

So it's not going to be as annoying as Leopard. But given the right set of less than fortuitous circumstances you still might have lost your data.

What's wrong here is the underlying document controller code, bound as it is to a 'hodgepodge' idea of a file system supposedly integrated with an alien operating system (and it was Apple's wish and no one else's) can get this less than reliable code tripping up over its own feet - with your data damaged as a result.

The Good News

The good news is that the same tests as performed here do not affect your file system and your data in the same way, even though the same type of mechanism is in use.

There's still the use of a temporary file.

And there's the test file.

Now let's try to save it as before.

Oops. Didn't work. But the good news is your file is still there.

Whatever hanky-panky was going on behind the scenes: your original file wasn't destroyed. A new file was not used to overwrite your file. The document controller may have saved your work temporarily in a different location, but at the end of the day it wrote to your file, it didn't dare trash it.

[Remember: Leopard trashes your file - with perhaps the only viable copy remaining in your program's process memory. Knock on wood. Ed.]

The Bad News

The bad news is a bit more complex. After this aborted operation NSDocumentController gets extremely confused and even hostile: if you try the same test again it will first claim it cannot find your file - even though you can see it there plain as day - and when you repeat the operation a second time (which confused users are likely to attempt) it will indeed destroy your file.

This time the file will disappear as it does so poetically on 10.5 Leopard all the time. But users are likely to try to 'save' more than once - and in so doing will trash their data. That data is not recoverable.

Bottom Line

The bottom line is you were safer on platforms prior to Leopard - but not by much. Given the slightest aberration in client 'user land' code Apple's system document controller code was liable to spin out of control and take your data down with it.

See Also
Hotspots: Leopard -Tmp-
Developers Workshop: Y.G.B.K.
Hotspots: Just An Ordinary Innocent Little Old Text File
Hotspots: (A Document Being Saved By Rixedit)/Untitled
Rixstep/7: ' A Document Being Saved on 10.4' (Membership Required)
Hotspots: (A Document Being Saved By Rixedit)/CocoaDocument-Based.rtx
Rixstep/7: '(A Document Being Saved By Rixedit)/Untitled' (Membership Required)
Rixstep/7: '(A Document Being Saved By Rixedit)/CocoaDocument-Based.rtx' (Membership Required)

About | Buy | Forum | Industry Watch | Learning Curve | Products | Search | Twitter | Xnews
Copyright © Rixstep. All rights reserved.