bugmonotone - Bugs: bug #29677, mtn log crashes if wrong database...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #29677: mtn log crashes if wrong database is specified

Submitter:  Thomas Keller <tommyd>
Submitted:  Mon 26 Apr 2010 02:15:20 PM UTC
   
 
Category:  error handling Severity:  3 - Normal
Item Group:  crash Status:  Fixed
Privacy:  Public Assigned to:  tommyd
Open/Closed:  Closed
mtn version --full: 

monotone 0.48dev (base revision: 3526825f1f6765fdef04effecdefc7f63e4d61d0)
Running on          : Linux 2.6.31.12-23-default #1 SMP 2010-03-22 16:18:05 +0100 i686
C++ compiler        : GNU C++ version 4.4.1 [gcc-4_4-branch revision 150839]
C++ standard library: GNU libstdc++ version 20090817
Boost version       : 1_39
SQLite version      : 3.6.16 (compiled against 3.6.16)
Lua version         : Lua 5.1
PCRE version        : 7.9 2009-04-11 (compiled against 7.9)
Botan version       : 1.6.4 (compiled against 1.6.4)
Changes since base revision:
format_version "1"

new_manifest [690b8fc4e2fd2594d785b7d95f546917b31af28b]

old_revision [3526825f1f6765fdef04effecdefc7f63e4d61d0]


Tue 27 Apr 2010 07:37:48 AM UTC, comment #1: 

The patch has been committed as 17de04cde8aaaff47f17927965130fd721d16ac6.

Thomas Keller <tommyd>
Group administrator
Mon 26 Apr 2010 02:15:20 PM UTC, original submission:  

Setup:

$ mtn clone host some.project some-project
$ mtn clone host some.other-project some-other-project
$ cd some-project
$ mtn log -d ../some-other-project/_MTN/mtn.db
mtn: fatal: error: wanted 1 rows got 0 in query: SELECT height FROM heights WHERE revision = ?

(Of course clone is not needed here at all, it was just the easiest way to show the problem.)

--debug shows off the exact place where the error occurs:

mtn: database.cc:1482: detected database error, 'E(want_rows == any_rows || want_rows == nrow)' violated


I think what we should do here is to check all edge_old_revision's we get from the workspace for existance in cmd_diff_log.cc:784 like this:

#
# old_revision [3526825f1f6765fdef04effecdefc7f63e4d61d0]
#
# patch "cmd_diff_log.cc"
#  from [37b1cfffa001ccc5b813fe6f0e84dc6a5dc3996e]
#    to [74f3dc3fa5ca6308fddbdbfa9cd895cf9dedf9e7]
#
============================================================
--- cmd_diff_log.cc     37b1cfffa001ccc5b813fe6f0e84dc6a5dc3996e
+++ cmd_diff_log.cc     74f3dc3fa5ca6308fddbdbfa9cd895cf9dedf9e7
@@ -781,9 +781,13 @@ CMD(log, "log", "", CMD_REF(informative)
       for (edge_map::const_iterator i = rev.edges.begin();
            i != rev.edges.end(); i++)
         {
-          starting_revs.insert(edge_old_revision(i));
+          revision_id rid = edge_old_revision(i);
+          E(db.revision_exists(rid), origin::user,
+            F("parent revision '%s' not found - did you "
+              "specify a wrong database?") % rid);
+          starting_revs.insert(rid);
           if (i == rev.edges.begin())
-            first_rid = edge_old_revision(i);
+            first_rid = rid;
         }
     }
   else if (!app.opts.from.empty())

Thomas Keller <tommyd>
Group administrator

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by tommyd (Submitted the item)
  •  

    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.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2010-04-27 tommyd StatusNone Fixed
        Assigned toNone tommyd
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code