nmh-workers
[Top] [All Lists]

Re: Synchronization Problem

2020-08-30 09:57:56
Ken Hornstein <kenh@pobox.com> writes:
fetchmail runs off a deamon and deposits emails which are in fine nmh format
but do not have a numeric names. So I run this script:
[...]
But after the scan is complete and before I do the rmm, the script might
have put a new message in +inbox, which rmm would remove.

There aren't _wonderful_ solutions, because this is a higher-level problem;
other programs can change the state of your inbox between commands.
Unless you want to do something like Kevin Cosgrove suggested, this is
fundamental to your design.  You could do some higher-level locking
where you prevent your script from running while you read your inbox.

I solved my particular problem by realizing that inc works fine when I point
it to a file containing just one message and no message dividers.

But it does illustrate what I think might be a more fundamental problem with
nmh: there is no way for that a user-written script can participate in nmh's
internal locking mechanism -- or if there is I don't recall where it is
documented. So I wonder if there is some way that this problem could be
resolved. Would it be very hard to implement a couple of new nmh commands?
Maybe something like this:

     nmhlock  [ -timeout milliseconds] (returns a token in stdout)
     nmhunlock token

    Norman Shapiro

<Prev in Thread] Current Thread [Next in Thread>