monotone - Bugs: bug #18125, 'mtn update' is not atomic; leaves...
You are not allowed to post comments on this tracker with your current authentication level.
bug #18125: 'mtn update' is not atomic; leaves workspace in a corrupted state on error
Submitter: | Ian Prest <ijprest> | ||
Submitted: | Thu 26 Oct 2006 11:29:56 PM UTC | ||
Category: | error handling | Severity: | 4 - Important |
Item Group: | None | Status: | None |
Privacy: | Public | Assigned to: | None |
Open/Closed: | Open | ||
mtn version --full: | monotone 0.30 (base revision: unknown)
|
No files currently attached
Depends on the following items: None found
Items that depend on this one: None found
There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.
Powered by Savane 3.13-02a9.
Corresponding source code
If 'update' fails (e.g., if it tried to update a file that was read-only), the workspace can be left in a corrupted state. Even if the cause of the error is fixed, running 'mtn update' a second time will again fail (for new reasons).
For example:
------------
mtn: updating along branch 'root'
mtn: selected update target f57a6687bd6fd8c152cc04f04a140490406fc14d
mtn: adding foo/a
mtn: adding foo/a/a
mtn: adding foo/a/b
mtn: modifying foo/1
mtn: error: renaming '_MTN/data.tmp.2968' to 'foo/1' failed: Access is denied. (5)
------------
Oops! foo/1 was read only, so the update failed. Fix the problem, and try again:
------------
mtn: updating along branch 'root'
mtn: selected update target f57a6687bd6fd8c152cc04f04a140490406fc14d
mtn: misuse: path 'foo/a' already exists, cannot create
------------
So I guess we'll need to delete the new directory (foo/a) that was added and try again:
------------
mtn: updating along branch 'root'
mtn: selected update target f57a6687bd6fd8c152cc04f04a140490406fc14d
mtn: misuse: path _MTN/tmp/1 already exists
------------
And it still didn't work, this time because Monotone failed to clean up it's temporary files. (FWIW, fixing this error will allow update to succeed in this example.)
This is very frustrating. For large databases, it might require significant work to get the workspace back to a good state. (It's often easier to start from scratch with 'mtn checkout', but then you'd lose any existing work.)
Note that you get similar problems if the first update deleted files:
------------
mtn: updating along branch 'root'
mtn: selected update target 8307d0c5809fe45349302d6c512d810448c81a99
mtn: dropping foo/aaa/a
mtn: dropping foo/aaa
mtn: modifying foo/2
mtn: error: renaming '_MTN/data.tmp.3928' to 'foo/2' failed: Access is denied. (5)
mtn: updating along branch 'root'
mtn: selected update target 8307d0c5809fe45349302d6c512d810448c81a99
mtn: warning: missing foo/aaa/a
mtn: misuse: 1 missing files; use 'mtn ls missing' to view
mtn: misuse: To restore consistency, on each missing file run either
mtn: misuse: 'mtn drop FILE' to remove it permanently, or
mtn: misuse: 'mtn revert FILE' to restore it.
mtn: misuse: To handle all at once, simply use
mtn: misuse: 'mtn drop --missing' or
mtn: misuse: 'mtn revert --missing'
------------