From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 342FB6DE0C45 for ; Fri, 18 Aug 2017 17:17:30 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[AWL=0.011, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01] 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 wK9o0Gd4YkFY for ; Fri, 18 Aug 2017 17:17:29 -0700 (PDT) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by arlo.cworth.org (Postfix) with ESMTPS id 470B76DE0C3D for ; Fri, 18 Aug 2017 17:17:29 -0700 (PDT) Received: from remotemail by fethera.tethera.net with local (Exim 4.89) (envelope-from ) id 1dirOk-00032i-Hf; Fri, 18 Aug 2017 20:13:54 -0400 Received: (nullmailer pid 739 invoked by uid 1000); Sat, 19 Aug 2017 00:17:25 -0000 From: David Bremner To: Yuri Volchkov , notmuch@notmuchmail.org Subject: Re: [PATCH 2/4] insert: strip trailing / in folder path In-Reply-To: <1502556453-11609-3-git-send-email-yuri.volchkov@gmail.com> References: <1502556453-11609-1-git-send-email-yuri.volchkov@gmail.com> <1502556453-11609-3-git-send-email-yuri.volchkov@gmail.com> Date: Fri, 18 Aug 2017 21:17:25 -0300 Message-ID: <87tw14fm22.fsf@tethera.net> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.23 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: Sat, 19 Aug 2017 00:17:30 -0000 Yuri Volchkov writes: > I have faced a problem, that messages sent by emacs could not be shown > or found later. The "notmuch show id:" says "no such file or > directory". > > The reason of this behavior is the following chain of events: > 1) While sending a message, emacs calls > notmuch insert --folder=maildir/Sent/ < test.msg > I think it will be less confusing if you give a more reduced description of the bug fix here. In particular the test in your previous patch shows that the neither offlineimap nor multiple copies of a message are needed to trigger this bug; rather it has to do with insufficient path canonicalization. > > The solution is simple, we have to strip trailing '/' from the insert > path. > > diff --git a/lib/database.cc b/lib/database.cc > index 8f0e22a..79eb3d6 100644 > --- a/lib/database.cc > +++ b/lib/database.cc > @@ -858,8 +858,7 @@ notmuch_database_open_verbose (const char *path, > notmuch->status_string = NULL; > notmuch->path = talloc_strdup (notmuch, path); > > - if (notmuch->path[strlen (notmuch->path) - 1] == '/') > - notmuch->path[strlen (notmuch->path) - 1] = '\0'; > + strip_trailing(notmuch->path, '/'); These seems like a reasonable change, but I don't see the connection with the notmuch-insert problem. Please either explain the connection in the commit message or split the change out into a different commit with an explanation of what it is fixing (and perhaps a seperate test, if there's a real problem there, rather than just tidying up).