From: Tomi Ollila <tomi.ollila@iki.fi>
To: Sean Whitton <spwhitton@spwhitton.name>, notmuch@notmuchmail.org
Subject: Re: [PATCH v2] nmbug: write tags out to a temporary file, not 'nmbug.index'
Date: Sun, 13 Feb 2022 20:08:55 +0200 [thread overview]
Message-ID: <m2sfsmvdu0.fsf@guru.guru-group.fi> (raw)
In-Reply-To: <87a6eu3csn.fsf@athena.silentflame.com>
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
prev parent reply other threads:[~2022-02-13 18:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <id:m2pmnr2o2f.fsf@guru.guru-group.fi>
2022-02-13 16:54 ` [PATCH v2] nmbug: write tags out to a temporary file, not 'nmbug.index' Sean Whitton
2022-02-13 17:17 ` Kyle Meyer
2022-02-13 17:18 ` Sean Whitton
2022-02-13 18:08 ` Tomi Ollila [this message]
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=m2sfsmvdu0.fsf@guru.guru-group.fi \
--to=tomi.ollila@iki.fi \
--cc=notmuch@notmuchmail.org \
--cc=spwhitton@spwhitton.name \
/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).