Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: precmd: write error: interrupted



[Cc'ing -workers]

On Apr 27,  7:42pm, Yuri D'Elia wrote:
} Subject: Re: precmd: write error: interrupted
}
} Just for my information, is there something I should do for these 2 
} issues (redirection and SIGWINCH); ie: file a bug report somewhere so it 
} doesn't get forgotten?

The mailing list is the place to file bug reports, so for the moment you
have done as much as you can ...

} I've seen this error for too long to let it go :)

The WINCH bug was tickling a memory so I went looking through the source
for mentions of SIGWINCH and found this in zle_main.c:zlread():

    /*
     * On some windowing systems we may enter this function before the
     * terminal is fully opened and sized, resulting in an infinite
     * series of SIGWINCH when the handler prints the prompt before we
     * have done so here.  Therefore, hold any such signal until the
     * first full refresh has completed.  The important bit is that the
     * handler must not see zleactive = 1 until ZLE really is active.
     * See the end of adjustwinsize() in Src/utils.c
     */
    queue_signals();

What you've been reporting is almost certainly another variation of the
same bug.  So maybe all we really need is this (plus some #ifdef):

diff --git a/Src/utils.c b/Src/utils.c
index 26e2a5c..a20a5e1 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -1323,7 +1323,9 @@ preprompt(void)
 
     /* If a shell function named "precmd" exists, *
      * then execute it.                           */
+    signal_block(signal_mask(SIGWINCH));  /* See zleread() */
     callhookfunc("precmd", NULL, 1, NULL);
+    signal_unblock(signal_mask(SIGWINCH));
     if (errflag)
        return;
 
There are a couple of other things in preprompt() that might want this
kind of wrapper too, e.g. periodic and the prepromptfns array, but we
can start with checking if the above is helpful.



Messages sorted by: Reverse Date, Date, Thread, Author