Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 60ADF431FDA for ; Mon, 28 Oct 2013 15:23:42 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.799 X-Spam-Level: X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ZWRW3wFx8wKW for ; Mon, 28 Oct 2013 15:23:37 -0700 (PDT) Received: from mail-qc0-f173.google.com (mail-qc0-f173.google.com [209.85.216.173]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id E15C5431E62 for ; Mon, 28 Oct 2013 15:23:30 -0700 (PDT) Received: by mail-qc0-f173.google.com with SMTP id l13so4241555qcy.18 for ; Mon, 28 Oct 2013 15:23:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=dG2N3zIEJA0hSNIte4FAXinmqJal/sp0/rD4QdVrVXw=; b=ZbTyLbEX17Sk/lmi5II2iDfpGdaQ9T8yrskW4lYWaNCeSBdY2EIqfnGxnKLqBuWzwR ETw/Dk+0cmixlfeh2XpOgPL/yyDz7v/yLuGHN2LhMelLy8NGdBsdcuoEzY5eWgvfFUru 2MiLERMrFETiq4NIJHLWX6hi7BSGqfFFK9eOPhBW5g3TgETzVuAUgnifADKEe6hgzit6 ppa+4u5lrUa7CZ391YPo7oXBAUUa9nPqdYLzceHGmGRpxKZH0sMdtc43ssMktB+kJrob WxzNWhDt7RC2ZJCP1zpAfwJz7q11LpneINKWd/Nxg1B34Gvp3VPdUOWBN161gUWAeB8h +vIw== X-Received: by 10.224.66.5 with SMTP id l5mr28534159qai.31.1382999010266; Mon, 28 Oct 2013 15:23:30 -0700 (PDT) Received: from ben-laptop.hasb.physics.cns (physicsnat56.physics.umass.edu. [128.119.50.38]) by mx.google.com with ESMTPSA id x1sm57796293qai.6.2013.10.28.15.23.29 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 28 Oct 2013 15:23:29 -0700 (PDT) From: Ben Gamari To: notmuch@notmuchmail.org Subject: [PATCH 4/4] database: Handle error while deleting uncompacted database Date: Mon, 28 Oct 2013 18:23:17 -0400 Message-Id: <1382998997-9938-4-git-send-email-bgamari.foss@gmail.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1382998997-9938-1-git-send-email-bgamari.foss@gmail.com> References: <1382998997-9938-1-git-send-email-bgamari.foss@gmail.com> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Oct 2013 22:23:42 -0000 We never checked to ensure that the rmtree() of the old database succeeded. Signed-off-by: Ben Gamari --- lib/database.cc | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/database.cc b/lib/database.cc index 34753ab..bfc5dac 100644 --- a/lib/database.cc +++ b/lib/database.cc @@ -934,7 +934,19 @@ notmuch_database_compact (const char* path, goto DONE; } } else { - rmtree(xapian_path); + if (rmtree(xapian_path)) { + fprintf (stderr, "Error removing old database: %s\n", + strerror(errno)); + fprintf (stderr, "\n"); + fprintf (stderr, "Old database: %s\n", xapian_path); + fprintf (stderr, "\n"); + fprintf (stderr, "Please remove the old database and move the compacted one in to place manually with\n"); + fprintf (stderr, "\n"); + fprintf (stderr, " mv %s %s\n", compact_xapian_path, xapian_path); + fprintf (stderr, "\n"); + ret = NOTMUCH_STATUS_FILE_ERROR; + goto DONE; + } } if (rename(compact_xapian_path, xapian_path)) { -- 1.8.3.2