From: Jani Nikula Date: Fri, 25 Sep 2015 20:48:46 +0000 (+0300) Subject: [PATCH 3/3] cli: delete directory documents on directory removal X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=b6ae6a99f0591ac1a40a156939281d058fe67f77;p=notmuch-archives.git [PATCH 3/3] cli: delete directory documents on directory removal --- diff --git a/3f/1f45e0c731f516a5b4c39661cd35b77aa403e5 b/3f/1f45e0c731f516a5b4c39661cd35b77aa403e5 new file mode 100644 index 000000000..cab3f5275 --- /dev/null +++ b/3f/1f45e0c731f516a5b4c39661cd35b77aa403e5 @@ -0,0 +1,129 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by arlo.cworth.org (Postfix) with ESMTP id A934D6DE0C3A + for ; Fri, 25 Sep 2015 13:49:21 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" +X-Spam-Flag: NO +X-Spam-Score: -0.156 +X-Spam-Level: +X-Spam-Status: No, score=-0.156 tagged_above=-999 required=5 + tests=[AWL=-0.180, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, + RCVD_IN_MSPIKE_WL=-0.01, URIBL_SBL=0.644, URIBL_SBL_A=0.1] + autolearn=disabled +Received: from arlo.cworth.org ([127.0.0.1]) + by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id ydWVKpyAWAh9 for ; + Fri, 25 Sep 2015 13:49:20 -0700 (PDT) +Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com + [209.85.212.181]) + by arlo.cworth.org (Postfix) with ESMTPS id 28D7A6DE1216 + for ; Fri, 25 Sep 2015 13:49:12 -0700 (PDT) +Received: by wicge5 with SMTP id ge5so36252877wic.0 + for ; Fri, 25 Sep 2015 13:49:10 -0700 (PDT) +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20130820; + h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to + :references:in-reply-to:references; + bh=ACYfOSYsYDvgwOI+5WUrSlr9NJzVF1jHSbab53uAx4o=; + b=QrUWqJ7cuvnzJBC6A1HT2KxNzC0vSa7f29KgYAvv1dplG3hZVFJ6Bf5LAI/MJzznJT + 0EcNzAzPXfMmONcPFzzSlZLowtcBjGWMi6vk2a2qBamp4uZYoerCe9N5BCrUzlfLIR7m + 8zDfZkkj6mzg4oPwaAhlUH2bbhfOrCxmJ390S1dim739d72wEa0R2xUJvmPpm3w191Oa + CgEBek5X5fq6/D7+1IKyIzA7QIiz2/eIEAVC34dvqfrhpRFVOex/OwCbFFiPSLJ6C9t8 + mPAIsKts23Kc4/5SOhAsH5bu9ICumaDf6ytk2o8Gqg1Os/ghVpsTI6pU6MoVFDv2rDUd + Ooxw== +X-Gm-Message-State: + ALoCoQmGFchM6k212xkGNsDuQwVr5fjZr/8wWqe7QVj5zqkJw3Hf808xzdUJzQ+gmAMhfYHxuITF +X-Received: by 10.180.102.226 with SMTP id fr2mr5876914wib.3.1443214150663; + Fri, 25 Sep 2015 13:49:10 -0700 (PDT) +Received: from localhost (mobile-access-bcee63-221.dhcp.inet.fi. + [188.238.99.221]) + by smtp.gmail.com with ESMTPSA id lj12sm4997002wic.0.2015.09.25.13.49.09 + (version=TLSv1/SSLv3 cipher=OTHER); + Fri, 25 Sep 2015 13:49:10 -0700 (PDT) +From: Jani Nikula +To: notmuch@notmuchmail.org +Subject: [PATCH 3/3] cli: delete directory documents on directory removal +Date: Fri, 25 Sep 2015 23:48:46 +0300 +Message-Id: + <591f5298ac3f2c79f727cac8bad1251830b28a3c.1443213654.git.jani@nikula.org> +X-Mailer: git-send-email 2.1.4 +In-Reply-To: +References: +In-Reply-To: +References: +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.18 +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: Fri, 25 Sep 2015 20:49:21 -0000 + +There was a problem with the directory documents being left behind +when the filesystem directory was removed. This was worked around in + +commit acd66cdec075312944e527febd46382e54d99367 +Author: Jani Nikula +Date: Sat Sep 5 12:35:31 2015 +0300 + + cli: reset db directory mtime upon directory removal + +However, that ignored the fact that the directory documents are also +still listed by notmuch_directory_get_child_directories() leading to +confusing results when running notmuch new. The directory documents +are found and queued for removal over and over again. + +Fix the problem for real by removing the directory documents. This +fixes the tests flagged as broken in + +commit ed9ceda623d3f22fb66365b33db63c5c982067d3 +Author: David Bremner +Date: Tue Aug 4 08:48:34 2015 +0200 + + test: add debugging output to notmuch-new tests, mark 5 as broken + +The (non-deterministic) hack test from [1] also still passes with this +change. + +[1] id:1441445731-4362-1-git-send-email-jani@nikula.org +--- + notmuch-new.c | 12 +++--------- + 1 file changed, 3 insertions(+), 9 deletions(-) + +diff --git a/notmuch-new.c b/notmuch-new.c +index 33645349cd5f..8bfed37fef96 100644 +--- a/notmuch-new.c ++++ b/notmuch-new.c +@@ -878,17 +878,11 @@ _remove_directory (void *ctx, + goto DONE; + } + +- /* +- * XXX: The library does not have a function to remove a directory +- * document for a path. Usually this doesn't matter except for a +- * slight waste of space. However, if the directory gets added to +- * the filesystem again, the old directory document is found with +- * the old mtime. Reset the directory mtime to avoid problems. +- */ +- notmuch_directory_set_mtime (directory, 0); ++ status = notmuch_directory_delete (directory); + + DONE: +- notmuch_directory_destroy (directory); ++ if (status) ++ notmuch_directory_destroy (directory); + return status; + } + +-- +2.1.4 +