[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [msmtp-users] [PATCH] msmtp: handle SIGPIPE locally



Hi!

Can you tell me how to trigger this problem? Under which circumstances
does msmtp get SIGPIPE on MacOS? (I'd like to know if this is
system-specific before applying the patch).

Martin

On Wed, 22 Mar 2017 09:38:30 +0000, Roger Pau Monne wrote:
> Ignore the SIGPIPE signal, since msmtp has no handler for it, and
> instead rely on the read/write errors.
> 
> This prevents the following error, at least on OS X:
> 
> * thread #1: [...] stop reason = signal SIGPIPE
>     frame #0: 0x00007fffd5c4d00a libsystem_kernel.dylib`__sendmsg + 10
> libsystem_kernel.dylib`__sendmsg:
> [...]
> (lldb) bt
> * thread #1: tid = 0x87c0f4, 0x00007fffd5c4d00a
> libsystem_kernel.dylib`__sendmsg + 10, queue =
> 'com.apple.main-thread', stop reason = signal SIGPIPE
>   * frame #0: 0x00007fffd5c4d00a libsystem_kernel.dylib`__sendmsg + 10
>     frame #1: 0x0000000101e5c69c libgnutls.30.dylib`system_writev + 41
>     frame #2: 0x0000000101e3d1ba
> libgnutls.30.dylib`_gnutls_io_write_flush + 428 frame #3:
> 0x0000000101e37689 libgnutls.30.dylib`_gnutls_send_tlen_int + 1222
> frame #4: 0x0000000101e5b78a libgnutls.30.dylib`gnutls_alert_send +
> 124 frame #5: 0x0000000101e36f4f libgnutls.30.dylib`gnutls_bye + 86
> frame #6: 0x0000000101e1e8bc msmtp`tls_close([...]) + 28 at
> tls.c:1736 [opt] frame #7: 0x0000000101e1c382 msmtp`smtp_close([...])
> + 34 at smtp.c:1905 [opt] frame #8: 0x0000000101e136ab
> msmtp`msmtp_sendmail [inlined] msmtp_endsession([...]) + 53 at
> msmtp.c:555 [opt] frame #9: 0x0000000101e13676
> msmtp`msmtp_sendmail([...]) + 1558 at msmtp.c:1913 [opt] frame #10:
> 0x0000000101e183e6 msmtp`main([...]) + 5094 at msmtp.c:4157 [opt]
> frame #11: 0x00007fffd5b1e255 libdyld.dylib`start + 1 (lldb) c
> Process 70391 resuming Process 70391 exited with status = 0
> (0x00000000) Terminated due to signal 13 --- Cc: marlam@...23...
> ---
>  src/msmtp.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/src/msmtp.c b/src/msmtp.c
> index c128ccd..ec06732 100644
> --- a/src/msmtp.c
> +++ b/src/msmtp.c
> @@ -3781,6 +3781,9 @@ int main(int argc, char *argv[])
>      textdomain(PACKAGE);
>  #endif
>  
> +    /* handle SIGPIPE locally, since there's no signal handler
> installed */
> +    signal(SIGPIPE, SIG_IGN);
> +
>      /* the command line */
>      if ((error_code = msmtp_cmdline(&conf, argc, argv)) != EX_OK)
>      {