[PATCH 2/3] compact: Give user more feedback on failure renaming

Ben Gamari bgamari.foss at gmail.com
Mon Oct 14 18:13:04 PDT 2013


Provide the user with instructions after we fail to move the old
un-compacted database out of the way.

Signed-off-by: Ben Gamari <bgamari.foss at gmail.com>
---
 lib/database.cc | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/lib/database.cc b/lib/database.cc
index 06f1c0a..57c2292 100644
--- a/lib/database.cc
+++ b/lib/database.cc
@@ -922,7 +922,14 @@ notmuch_database_compact (const char* path,
 
     if (old_xapian_path != NULL) {
 	if (rename(xapian_path, old_xapian_path)) {
-	    fprintf (stderr, "Error moving old database out of the way\n");
+	    fprintf (stderr, "Error moving old database out of the way: %s\n",
+		     strerror(errno));
+	    fprintf (stderr, "\n");
+	    fprintf (stderr, "Old database: %s\n", xapian_path);
+	    fprintf (stderr, "Compacted database: %s\n", compact_xapian_path);
+	    fprintf (stderr, "\n");
+	    fprintf (stderr, "At this point it's probably best to remove the compacted database,\n");
+	    fprintf (stderr, "find the cause of this error, and try compacting again.\n");
 	    ret = NOTMUCH_STATUS_FILE_ERROR;
 	    goto DONE;
 	}
-- 
1.8.1.2



More information about the notmuch mailing list