Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Fri, 16 Aug 2002 20:34:09 +0200 From: Pavel Tsekov Reply-To: Pavel Tsekov X-Priority: 3 (Normal) Message-ID: <119122398409.20020816203409@gmx.net> To: cygwin AT cygwin DOT com CC: mc-devel AT gnome DOT org, cygwin-patches AT cygwin DOT com Subject: [PATCH suggestion] exceptions.cc, interrupt_setup () MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----------678EE7140E7CD8" Note-from-DJ: This may be spam ------------678EE7140E7CD8 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hello, there! :) Someone might remember that the main reason for delaying the Midnight Commander release for Cygwin so long was that there was a problem with the subshell support. I was thinking that this was a problem in Cygwin, but I wasn't able to track it down... until today. This issue went to the mc-devel list and stalled there for some time until recently Pavel Roskin offered his help to debug the problem. Based on his finding (http://mail.gnome.org/archives/mc-devel/2002-August/msg00062.html) I was able to track down the problem in the cygwin signal handling code. The problem is triggered by the sigdelayed0() code which always restores the signal mask (exceptions.cc, line 1237) using sigsave.oldmask. The real problem is that the sigsave.oldmask field is never initialised when preparing to execute a signal handler. So imagine that someone set sigsave.oldmask to some value (sigsuspend() in this case), then you will always get this value as the signal mask after a signal handler is called. I suggest the following very simple patch. Since I may have not understand all the specifics of the signal handling mechanism I offer it for discussion. Just for the record - this patch solves that outstanding problem with MC. Thanks! Pavel Tsekov ------------678EE7140E7CD8 Content-Type: application/octet-stream; name="exceptions.cc.diff" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="exceptions.cc.diff" LS0tIGV4Y2VwdGlvbnMuY2MJMjAwMi0wNy0yNCAwNzozOToyMi4wMDAwMDAwMDAgKzAyMDAKKysr IGV4Y2VwdGlvbnMuY2MucGF0Y2hlZAkyMDAyLTA4LTE2IDIwOjMyOjA3LjAwMDAwMDAwMCArMDIw MApAQCAtNjg2LDcgKzY4Niw4IEBAIGludGVycnVwdF9zZXR1cCAoaW50IHNpZywgdm9pZCAqaGFu ZGxlciwKICAgc2lnc2F2ZS5yZXRhZGRyID0gcmV0YWRkcjsKICAgc2lnc2F2ZS5yZXRhZGRyX29u X3N0YWNrID0gcmV0YWRkcl9vbl9zdGFjazsKICAgLyogRklYTUU6IE5vdCBtdWx0aS10aHJlYWQg YXdhcmUgKi8KLSAgc2lnc2F2ZS5uZXdtYXNrID0gbXlzZWxmLT5nZXRzaWdtYXNrICgpIHwgc2ln YS5zYV9tYXNrIHwgU0lHVE9NQVNLIChzaWcpOworICBzaWdzYXZlLm9sZG1hc2sgPSBteXNlbGYt PmdldHNpZ21hc2sgKCk7CisgIHNpZ3NhdmUubmV3bWFzayA9IHNpZ3NhdmUub2xkbWFzayB8IHNp Z2Euc2FfbWFzayB8IFNJR1RPTUFTSyAoc2lnKTsKICAgc2lnc2F2ZS5zYV9mbGFncyA9IHNpZ2Eu c2FfZmxhZ3M7CiAgIHNpZ3NhdmUuZnVuYyA9ICh2b2lkICgqKShpbnQpKSBoYW5kbGVyOwogICBz aWdzYXZlLnNpZyA9IHNpZzsK ------------678EE7140E7CD8 Content-Type: text/plain; charset=us-ascii -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ ------------678EE7140E7CD8--