On Mon, 6 Sep 2021, Steffen Nurpmeso steffen-at-sdaoden.eu |s-nail| wrote:

I hope you are rich enough to have not only survived the flooding,
but are also able to solve the damage done!

Thanks for your concern. I was fortunate and was not personally affected by the floods.

We will always read back the edited
file _if_ the size or its timestamp changed (aka whenever it seems
to have been modified, easy approach aka not checksum-checked),
_unless_ the editor exits with a non-0 exit status.

I hadn't realized about that "unless", and that the non-0 status could be caused by a signal passed down by the parent s-nail process, as opposed to some event within the editor itself.

If your editor would be

 #!/bin/sh -
 trap : ALRM HUP INT QUIT TERM
 the-real-editor "$@"
 exit 0

then your problem with not reading back the temporary file should
not happen.

Right, that does seem to prevent the edit from getting lost. It is difficult to test, because the imap server disconnects in an unpredictable way, but, so far, so good.

 5.4.    Autologout Timer

    If a server has an inactivity autologout timer, the duration
    of that timer MUST be at least 30 minutes.  The receipt of
    ANY command from the client during that interval SHOULD
    suffice to reset the autologout timer.

My impression is that the disconnections are caused by something other than the timer timing out. Some days it happens a lot, other days not at all.

The problem that lasted after my first (second with that
SO_RCVTIMEOU) patch was that now SIGALRM was allowed again while
editing, but that an installed alarm(2) timer is inherited by
child processes, which is why your version of ed(1) seems to have
exited with a non-0 exit status, after having seen a SIGALRM,
though the default action of SIGARLM is

    SIGALRM      P1990      Term    Timer signal from alarm(2)

terminate says signal(7).  So the next patch on top of the first
patch drops such installed alarm(2) actions in child processes.

With these three patches which are on [master, stable/stable,
stable/latest, stable/v14.9] (uff) i can wholeheartly put the
blame on other people.

So with the patches in place, why should I need to wrap the editor with the script above? Is there some other way for signals to get through?

Stephen Isard

Reply via email to