Welcome to Brian Webster's Blog

Saving, Versions, and data loss

 | 

I recently read a short post over at Glenn Reid’s blog describing a situation he ran across with Apple’s new document model (as of OS X 10.7). The new model frequently autosaves the current state of an open document to disk rather than waiting for an explicit save command. It’s when another program (in his example, Dropbox) overwrites the file on disk while the document is still open that hilarity ensues. However, while this situation does have a plethora of confusing language and UI, there is not in fact any data loss in the process. Let’s walk through a similar example, step by step.

1. Create a new document in TextEdit, type some text into it, and save the document.

2. Add some more text to the document, but do not use the save command yet. You can see that the document is labelled as “Edited” in the title bar.

3. Instead of setting up a Dropbox sync, I’m just going to open the file in a terminal window using nano, but the behavior here will be the same as if Dropbox had been the one to write over the file. You can see when we open the file that the new text has already been saved to disk, even though we never hit Save in TextEdit.

4. Now let’s replace the existing content with some new text, then tell nano to save its changes to the file.

5. When we switch back to TextEdit, we still see the previous content, and not the new changes we just applied using nano. However, when we hit Save, that’s when we see the same dialog that Glenn came across.

This is the point where the aforementioned confusing language and UI comes in. If we take a closer look at this message, there is a key phrase that’s easy to miss:

Click Save Anyway to keep your changes and save the changes made by the other application as a version , or click Revert to keep the changes from the other application and save your changes as a version.

This is the “Versions” part of Versions & Autosave kicking in. No matter which button we choose, both versions of the document will be saved: our version from TextEdit, and the version written behind our backs by Dropbox/nano. The only difference between the two choices is which version we will see in the TextEdit window immediately afterwards.

After clicking “Save Anyway”, if we go to File > Revert > Browse All Versions…, we can see that both versions of the document are still available.

So, while there are definitely issues with how this is presented to the user, there is not actually any data lost in this situation.