unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Yuri Volchkov <yuri.volchkov@gmail.com>
To: David Bremner <david@tethera.net>, notmuch@notmuchmail.org
Subject: Re: [PATCH 2/4] insert: strip trailing / in folder path
Date: Sat, 19 Aug 2017 10:27:28 +0200	[thread overview]
Message-ID: <tza4s2a82w3qtr.fsf@N-1128.office.hd> (raw)
In-Reply-To: <87tw14fm22.fsf@tethera.net>

David Bremner <david@tethera.net> writes:

> Yuri Volchkov <yuri.volchkov@gmail.com> writes:
>
>> I have faced a problem, that messages sent by emacs could not be shown
>> or found later. The "notmuch show id:<msg_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.

You are probably right, I was too obsessed with the problem blocking my
switch-to-notmuch project . I'll try to reduce the commit message.

>>
>> 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).

This is just for consistency reasons. Fixing my problem required the
same piece of code, which was used here. Duplicating is not nice, so I
made a function around this code. That's why it feels atomic change
to me.

I think, explanation like this is superfluously detailed.

I can move the introduction of the strip_trailing and cleaning
notmuch_database_open_verbose into separate patch, but the fix then will
be just a one line. And I'll get unnecessarily tiny patches.

What do you think?

  reply	other threads:[~2017-08-19  8:27 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-12 16:47 [PATCH 0/4] fix "no such file" problem for emails send by emacs Yuri Volchkov
2017-08-12 16:47 ` [PATCH 1/4] test: insert into the folder with trailing / Yuri Volchkov
2017-08-17  1:21   ` David Bremner
2017-08-20 12:16   ` David Bremner
2017-08-12 16:47 ` [PATCH 2/4] insert: strip trailing / in folder path Yuri Volchkov
2017-08-19  0:17   ` David Bremner
2017-08-19  8:27     ` Yuri Volchkov [this message]
2017-08-19 12:55       ` David Bremner
2017-08-12 16:47 ` [PATCH 3/4] test: show id:<> works even if the first duplicated is deleted Yuri Volchkov
2017-08-12 16:47 ` [PATCH 4/4] show: workaround for the missing file problem Yuri Volchkov
2017-08-13 12:41 ` [PATCH 0/4] fix "no such file" problem for emails send by emacs David Bremner
2017-08-13 21:56   ` Yuri Volchkov
2017-08-16 11:32     ` David Bremner
2017-08-21 15:44 ` [PATCH v2 0/4] fix insufficient path canonization Yuri Volchkov
2017-08-21 15:44   ` [PATCH v2 1/4] database: move striping of trailing '/' into helper function Yuri Volchkov
2017-08-21 15:44   ` [PATCH v2 2/4] insert: strip trailing / in folder path Yuri Volchkov
2017-08-21 15:44   ` [PATCH v2 3/4] test: show id:<> works even if the first duplicate is deleted Yuri Volchkov
2017-08-21 15:44   ` [PATCH v2 4/4] show: workaround for the missing file problem Yuri Volchkov
2017-08-23  0:19   ` [PATCH v2 0/4] fix insufficient path canonization David Bremner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tza4s2a82w3qtr.fsf@N-1128.office.hd \
    --to=yuri.volchkov@gmail.com \
    --cc=david@tethera.net \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).