Re: [PATCH v2] nmbug: write tags out to a temporary file, not 'nmbug.index'

Subject: Re: [PATCH v2] nmbug: write tags out to a temporary file, not 'nmbug.index'

Date: Sun, 13 Feb 2022 20:08:55 +0200

To: Sean Whitton, notmuch@notmuchmail.org

Cc:

From: Tomi Ollila


On Sun, Feb 13 2022, Sean Whitton wrote:

> Hello,
>
> On Sun 13 Feb 2022 at 09:54am -07, Sean Whitton wrote:
>
>> If more than nmbug process is running at once, then each will try to
>> read and write the same file.  The particular failure I've seen is
>> that the process which finishes first deletes nmbug.index, and then
>> the other process dies with a FileNotFoundError.  So use a distinct
>> temporary file per process.
>> ---
>>  devel/nmbug/nmbug | 44 ++++++++++++++++++++++----------------------
>>  1 file changed, 22 insertions(+), 22 deletions(-)
>>
>> Here is a second attempt, though I'm afraid I have little idea whether it is
>> idiomatic Python.
>
> It would seem this causes 'nmbug status' to output just one result.
>
> I'll leave the fix to someone with more Python experience.  Sorry for
> the improperly tested v2 patch.

One option would be using the first patch, but instead of mkstemp(),
NamedTemporaryFile(dir=NMBGIT, prefix="nmbug.index") to be used instead
(and then path.name and index.name in place of path and index...)

Tomi

>
> -- 
> Sean Whitton
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: