[RFC PATCH 04/14] Not all filenames need to be converted to absolute paths
authorEthan Glasser-Camp <ethan.glasser.camp@gmail.com>
Mon, 25 Jun 2012 20:41:29 +0000 (16:41 +2000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:47:49 +0000 (09:47 -0800)
50/e06239ec44ffff30da4374fad52320eeb6152e [new file with mode: 0644]

diff --git a/50/e06239ec44ffff30da4374fad52320eeb6152e b/50/e06239ec44ffff30da4374fad52320eeb6152e
new file mode 100644 (file)
index 0000000..e195046
--- /dev/null
@@ -0,0 +1,102 @@
+Return-Path: <ethan.glasser.camp@gmail.com>\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 74D7D431FB6\r
+       for <notmuch@notmuchmail.org>; Mon, 25 Jun 2012 13:43:35 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 1.061\r
+X-Spam-Level: *\r
+X-Spam-Status: No, score=1.061 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_FROM=0.001, RCVD_IN_BL_SPAMCOP_NET=1.246,\r
+       RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_SORBS_WEB=0.614] 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 gaVyWTs22Yro for <notmuch@notmuchmail.org>;\r
+       Mon, 25 Jun 2012 13:43:34 -0700 (PDT)\r
+Received: from mail-we0-f181.google.com (mail-we0-f181.google.com\r
+       [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id AD3FD431FAF\r
+       for <notmuch@notmuchmail.org>; Mon, 25 Jun 2012 13:43:34 -0700 (PDT)\r
+Received: by mail-we0-f181.google.com with SMTP id j55so3641437wer.26\r
+       for <notmuch@notmuchmail.org>; Mon, 25 Jun 2012 13:43:34 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+       h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;\r
+       bh=2g6fkbspKufW8i3FIxqeJ+0mMu74Hdt3y8rYV9jx2YM=;\r
+       b=NW7Q72PrWAc1OqxJppQQBwNdqdF85bfaMXDC1CuZVg9+vd3oxt1llqb0yfhzKzXxkD\r
+       L4qjMyNkNednQ3cHuNnAJBl20qRf7sZCevupc4Sjq238MrHdLzRoXLIJrm/S7gkcYgK9\r
+       jaMAQJOWwU1aWq99/lj60H0RLvHIt90fUIhss1I6adyGJ+5mTB2CaYSy8sf5bDV8i2mh\r
+       bFLMqTKAloX03n8aFLpj6VIWrHSrVmBuOISs+cUX7zRBl1Y6VqWlczmkknUgTtU8ccuj\r
+       dJ/kkBb666aADB/mV/O6xhGEFcTCXyfOGcgp8RTnfjuegmajNf5APoDoFc+7pauppvIY\r
+       JDuA==\r
+Received: by 10.216.212.1 with SMTP id x1mr7098348weo.143.1340657011561;\r
+       Mon, 25 Jun 2012 13:43:31 -0700 (PDT)\r
+Received: from localhost ([195.24.209.21])\r
+       by mx.google.com with ESMTPS id ei4sm37314729wid.5.2012.06.25.13.43.19\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Mon, 25 Jun 2012 13:43:30 -0700 (PDT)\r
+From: Ethan Glasser-Camp <ethan.glasser.camp@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [RFC PATCH 04/14] Not all filenames need to be converted to absolute\r
+       paths\r
+Date: Mon, 25 Jun 2012 16:41:29 -0400\r
+Message-Id: <1340656899-5644-5-git-send-email-ethan@betacantrips.com>\r
+X-Mailer: git-send-email 1.7.9.5\r
+In-Reply-To: <1340656899-5644-1-git-send-email-ethan@betacantrips.com>\r
+References: <1340656899-5644-1-git-send-email-ethan@betacantrips.com>\r
+X-Mailman-Approved-At: Tue, 26 Jun 2012 03:51:54 -0700\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: Mon, 25 Jun 2012 20:43:35 -0000\r
+\r
+_notmuch_message_ensure_filename_list converts "relative" paths, such\r
+as those stored in Xapian until now, to "absolute" paths. However,\r
+URLs are already absolute, and prepending the database path will just\r
+confuse matters.\r
+\r
+Signed-off-by: Ethan Glasser-Camp <ethan@betacantrips.com>\r
+---\r
+ lib/message.cc |   14 +++++++++++---\r
+ 1 file changed, 11 insertions(+), 3 deletions(-)\r
+\r
+diff --git a/lib/message.cc b/lib/message.cc\r
+index 978de06..c9857f5 100644\r
+--- a/lib/message.cc\r
++++ b/lib/message.cc\r
+@@ -700,9 +700,17 @@ _notmuch_message_ensure_filename_list (notmuch_message_t *message)\r
+                                                         message->notmuch,\r
+                                                         directory_id);\r
\r
+-      if (strlen (directory))\r
+-          filename = talloc_asprintf (message, "%s/%s/%s",\r
+-                                      db_path, directory, basename);\r
++      if (strlen (directory)) {\r
++          /* If directory is a URI, we don't need to append the db_path;\r
++           * it is already an absolute path. */\r
++          /* This is just a quick hack instead of actually parsing the URL. */\r
++          if (strstr (directory, "://") == NULL)\r
++              filename = talloc_asprintf (message, "%s/%s/%s",\r
++                                          db_path, directory, basename);\r
++          else\r
++              filename = talloc_asprintf (message, "%s/%s",\r
++                                          directory, basename);\r
++      }\r
+       else\r
+           filename = talloc_asprintf (message, "%s/%s",\r
+                                       db_path, basename);\r
+-- \r
+1.7.9.5\r
+\r