--- /dev/null
+Return-Path: <jani@nikula.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id D2491431FCF\r
+ for <notmuch@notmuchmail.org>; Fri, 1 Nov 2013 07:27:50 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+ tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id G47kYK6BCWOR for <notmuch@notmuchmail.org>;\r
+ Fri, 1 Nov 2013 07:27:46 -0700 (PDT)\r
+Received: from mail-wi0-f169.google.com (mail-wi0-f169.google.com\r
+ [209.85.212.169]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 0A7F6431FB6\r
+ for <notmuch@notmuchmail.org>; Fri, 1 Nov 2013 07:27:39 -0700 (PDT)\r
+Received: by mail-wi0-f169.google.com with SMTP id cb5so1237160wib.0\r
+ for <notmuch@notmuchmail.org>; Fri, 01 Nov 2013 07:27:39 -0700 (PDT)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+ d=1e100.net; s=20130820;\r
+ h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\r
+ :references:in-reply-to:references;\r
+ bh=L6RtrXIIcwBcQfTxl8xlmmmZxLPbjvFVzgpJF1mDeY0=;\r
+ b=huA33NhJRaMA8lmR0i1zJ2x0v5iKCDKFcafqjLd9bJFnf46JZaFGv9UeWpicBBzWRD\r
+ 2iOMcXeIthN3OMStttmS2ySlY11FDqlEcSs9onXnyuKv9WavSygNJzFFuIguEqAJkP+/\r
+ W8u6QIYxCwojLfwkir/hiHNXMn0ErXdOCbpSYCIwwTPszOcTFAvh61OaX0GnnfiAp5Uy\r
+ 6jyXc6waeSsNA35JxLb8Rp7AI2chHMcZeMa/17BRcdyrB2UXZBiFCoynTAP68e77YdSL\r
+ 3H2hB5emecvsLtJbB8chUjPpVP/LGOSii1f5AYeX1dOvElVhKdJGpIHyWSCefNl89fNy\r
+ pYjA==\r
+X-Gm-Message-State:\r
+ ALoCoQm+R/8LoKPJ6SZKu/W80W3wyfDNvcqZv0vM6FeAEtHgGeD5gerfOFT0V6/HASooLT5fWRCd\r
+X-Received: by 10.180.188.164 with SMTP id gb4mr2693858wic.52.1383316058942;\r
+ Fri, 01 Nov 2013 07:27:38 -0700 (PDT)\r
+Received: from localhost ([2001:4b98:dc0:43:216:3eff:fe1b:25f3])\r
+ by mx.google.com with ESMTPSA id ey4sm8027832wic.11.2013.11.01.07.27.37\r
+ for <multiple recipients>\r
+ (version=TLSv1.1 cipher=RC4-SHA bits=128/128);\r
+ Fri, 01 Nov 2013 07:27:38 -0700 (PDT)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 3/6] lib: use the backup path provided by the user,\r
+ don't add anything to it\r
+Date: Fri, 1 Nov 2013 15:27:12 +0100\r
+Message-Id:\r
+ <9ee3f2334a117b0a1b88650f44432423cbe95fd7.1383315568.git.jani@nikula.org>\r
+X-Mailer: git-send-email 1.7.2.5\r
+In-Reply-To: <cover.1383315568.git.jani@nikula.org>\r
+References: <cover.1383315568.git.jani@nikula.org>\r
+In-Reply-To: <cover.1383315568.git.jani@nikula.org>\r
+References: <cover.1383315568.git.jani@nikula.org>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Fri, 01 Nov 2013 14:27:51 -0000\r
+\r
+Adding another level is just useless cruft.\r
+---\r
+ lib/database.cc | 14 ++++----------\r
+ notmuch-compact.c | 4 ++--\r
+ 2 files changed, 6 insertions(+), 12 deletions(-)\r
+\r
+diff --git a/lib/database.cc b/lib/database.cc\r
+index da549b4..9c99ac6 100644\r
+--- a/lib/database.cc\r
++++ b/lib/database.cc\r
+@@ -868,7 +868,6 @@ notmuch_database_compact (const char* path,\r
+ {\r
+ void *local = talloc_new (NULL);\r
+ char *notmuch_path, *xapian_path, *compact_xapian_path;\r
+- char *old_xapian_path = NULL;\r
+ notmuch_status_t ret = NOTMUCH_STATUS_SUCCESS;\r
+ notmuch_database_t *notmuch = NULL;\r
+ struct stat statbuf;\r
+@@ -894,13 +893,8 @@ notmuch_database_compact (const char* path,\r
+ }\r
+ \r
+ if (backup_path != NULL) {\r
+- if (! (old_xapian_path = talloc_asprintf (local, "%s/xapian.old", backup_path))) {\r
+- ret = NOTMUCH_STATUS_OUT_OF_MEMORY;\r
+- goto DONE;\r
+- }\r
+-\r
+- if (stat(old_xapian_path, &statbuf) != -1) {\r
+- fprintf (stderr, "Backup path already exists: %s\n", old_xapian_path);\r
++ if (stat(backup_path, &statbuf) != -1) {\r
++ fprintf (stderr, "Backup path already exists: %s\n", backup_path);\r
+ ret = NOTMUCH_STATUS_FILE_ERROR;\r
+ goto DONE;\r
+ }\r
+@@ -924,8 +918,8 @@ notmuch_database_compact (const char* path,\r
+ goto DONE;\r
+ }\r
+ \r
+- if (old_xapian_path != NULL) {\r
+- if (rename(xapian_path, old_xapian_path)) {\r
++ if (backup_path) {\r
++ if (rename(xapian_path, backup_path)) {\r
+ fprintf (stderr, "Error moving old database out of the way\n");\r
+ ret = NOTMUCH_STATUS_FILE_ERROR;\r
+ goto DONE;\r
+diff --git a/notmuch-compact.c b/notmuch-compact.c\r
+index ee7afcf..043710f 100644\r
+--- a/notmuch-compact.c\r
++++ b/notmuch-compact.c\r
+@@ -42,11 +42,11 @@ notmuch_compact_command (notmuch_config_t *config,\r
+ } else {\r
+ printf ("\n");\r
+ printf ("\n");\r
+- printf ("The old database has been moved to %s/xapian.old", backup_path);\r
++ printf ("The old database has been moved to %s", backup_path);\r
+ printf ("\n");\r
+ printf ("To delete run,\n");\r
+ printf ("\n");\r
+- printf (" rm -R %s/xapian.old\n", backup_path);\r
++ printf (" rm -R %s\n", backup_path);\r
+ printf ("\n");\r
+ }\r
+ \r
+-- \r
+1.7.2.5\r
+\r