On Fri, 22 Mar 2024 19:00:43 -0400
Ryan Raymond <rjraym...@oakland.edu> wrote:
> Thank you, Thomas.
> I do wonder if this is good behavior to have in Guile. I feel like we
> should replace that signal with an error. It's not good for programs to
> exit without an explanation.
> 
> However, thank you for your help.
> Ryan

I suppose the justification for leaving things as they are is that it
is consistent with POSIX.  Amongst the first things that any POSIX
application writing to a socket has to do is to set SIG_IGN as the
handler for SIGPIPE so that writing to a closed socket causes errno to
be set to EPIPE instead of the write raising a SIGPIPE signal.

You could argue that the POSIX defaults are wrong: another socket
configuration which is often needed is to set SO_REUSEADDR on the
socket, which you would have thought should be the default.  The
argument for SIGPIPE is that it is necessary in order to obtain the
correct behaviour when piping at the unix shell: you do want a signal to
terminate the chain of pipes in that case if one is broken.  But how
often do you pipe executables at the unix shell writing to sockets?
Approximately never.

Chris

Reply via email to