monotone

Issue 53: 'mtn update' is not atomic; leaves workspace in a corrupted state on error

Reported by Unknown User, Oct 27, 2006

(This entry was imported from the savannah tracker, original 
location: https://savannah.nongnu.org/bugs/index.php?18125)

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 update
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 update
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 update
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 update
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)

> fix the problem

> mtn update
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'
------------


monotone version:
-----------------
monotone 0.30 (base revision: unknown)
Running on          : Windows NT/2000/XP/2003 (5.1, build 2600, 
Service Pack 2) on ia32 (level 15, rev 8962)
C++ compiler        : GNU C++ version 3.4.2 (mingw-special)
C++ standard library: GNU libstdc++ version 20040907
Boost version       : 1_33_1
Changes since base revision:
unknown

Comment 1 by Unknown User, Jan 14, 2009

http://oszone.info

Created: 18 years 25 days ago by Unknown User

Updated: 15 years 10 months ago

Status: New

Labels:
Priority:High
Type:Other
Component:Error Handling

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status