Re: [PATCH 0/4] Allow specifying alternate names for addresses in other_email
[notmuch-archives.git] / 35 / 0c917aebf6f077bf94c7c4e7850e181ecb48bc
1 Return-Path: <too@guru-group.fi>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 18972429E4F\r
6         for <notmuch@notmuchmail.org>; Mon, 11 Nov 2013 09:56:00 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id rOWV1hIRNZL6 for <notmuch@notmuchmail.org>;\r
16         Mon, 11 Nov 2013 09:55:50 -0800 (PST)\r
17 Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
18         by olra.theworths.org (Postfix) with ESMTP id F0743429E31\r
19         for <notmuch@notmuchmail.org>; Mon, 11 Nov 2013 09:55:49 -0800 (PST)\r
20 Received: by guru.guru-group.fi (Postfix, from userid 501)\r
21         id A08011000F3; Mon, 11 Nov 2013 19:55:45 +0200 (EET)\r
22 From: Tomi Ollila <tomi.ollila@iki.fi>\r
23 To: notmuch@notmuchmail.org\r
24 Subject: [PATCH 3/3] lib: provide user more information on after-compaction\r
25         failures\r
26 Date: Mon, 11 Nov 2013 19:55:38 +0200\r
27 Message-Id: <1384192538-15291-4-git-send-email-tomi.ollila@iki.fi>\r
28 X-Mailer: git-send-email 1.8.0\r
29 In-Reply-To: <1384192538-15291-1-git-send-email-tomi.ollila@iki.fi>\r
30 References: <1384192538-15291-1-git-send-email-tomi.ollila@iki.fi>\r
31 Cc: tomi.ollila@iki.fi\r
32 X-BeenThere: notmuch@notmuchmail.org\r
33 X-Mailman-Version: 2.1.13\r
34 Precedence: list\r
35 List-Id: "Use and development of the notmuch mail system."\r
36         <notmuch.notmuchmail.org>\r
37 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
38         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
39 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
40 List-Post: <mailto:notmuch@notmuchmail.org>\r
41 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
42 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
43         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
44 X-List-Received-Date: Mon, 11 Nov 2013 17:56:00 -0000\r
45 \r
46 After database has been compacted, there are steps to put the new\r
47 database into place -- and these steps may fail. Provide better\r
48 information how to resolve these failure cases.\r
49 \r
50 Thanks to Ben Gamari for most of the information content.\r
51 ---\r
52  lib/database.cc | 38 ++++++++++++++++++++++++++++++++++----\r
53  1 file changed, 34 insertions(+), 4 deletions(-)\r
54 \r
55 diff --git a/lib/database.cc b/lib/database.cc\r
56 index 78693b7..40272dc 100644\r
57 --- a/lib/database.cc\r
58 +++ b/lib/database.cc\r
59 @@ -937,19 +937,49 @@ notmuch_database_compact (const char* path,\r
60      }\r
61  \r
62      if (rename(xapian_path, backup_path)) {\r
63 -       fprintf (stderr, "Error moving old database out of the way\n");\r
64 +       fprintf (stderr, "Error moving old database out of the way:\n"\r
65 +                "Old database: %s\n"\r
66 +                "Backup database: %s\n"\r
67 +                "Error: %s\n", xapian_path, backup_path, strerror (errno));\r
68         ret = NOTMUCH_STATUS_FILE_ERROR;\r
69         goto DONE;\r
70      }\r
71  \r
72      if (rename(compact_xapian_path, xapian_path)) {\r
73 -       fprintf (stderr, "Error moving compacted database\n");\r
74 +       fprintf (stderr, "Error moving compacted database into place: %s\n", strerror (errno));\r
75 +       fprintf (stderr, "\n"\r
76 +                "Encountered error while moving the compacted database\n"\r
77 +                "\n"\r
78 +                "    %s\n"\r
79 +                "\n"\r
80 +                "to\n"\r
81 +                "\n"\r
82 +                "    %s\n"\r
83 +                "\n"\r
84 +                "Please identify the reason for this and move the compacted database\n"\r
85 +                "into place manually.\n"\r
86 +                "\n"\r
87 +                "Alternatively you can revert to the uncompacted database with\n"\r
88 +                "\n"\r
89 +                "    mv '%s' '%s'\n"\r
90 +                "\n", compact_xapian_path, xapian_path,\r
91 +                backup_path, xapian_path);\r
92         ret = NOTMUCH_STATUS_FILE_ERROR;\r
93         goto DONE;\r
94      }\r
95  \r
96 -    if (! keep_backup)\r
97 -       rmtree (backup_path);\r
98 +    if (! keep_backup) {\r
99 +       if (rmtree (backup_path)) {\r
100 +           fprintf (stderr, "Error removing backup database: %s\n",\r
101 +                    strerror (errno));\r
102 +           fprintf (stderr, "\n"\r
103 +                    "Please remove the backup database with\n"\r
104 +                    "\n"\r
105 +                    "   rm -rf '%s'\n" "\n", backup_path);\r
106 +           ret = NOTMUCH_STATUS_FILE_ERROR;\r
107 +           goto DONE;\r
108 +       }\r
109 +    }\r
110  \r
111  DONE:\r
112      if (notmuch)\r
113 -- \r
114 1.8.3.1\r
115 \r