Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Message-ID: <000501c02ca3$85c5d480$e30a063e@emerald> From: "Steve O'Brien" To: Cc: Subject: re: patch for inetutils Date: Mon, 2 Oct 2000 20:03:51 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.2615.200 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200 Hi Corinna Vinschen wrote: > Steve O'Brien wrote: >> 1) rlogin - does not terminate cleanly >> This is because of an error in setting signals - specifically catch_client >> does not get installed as the handler for SIGCHLD so that the parent process >> does not tidy up correctly when its child terminates. My fix is a very minor >> change to libinetutils/setsig.c > Hmm, this does fix the problem only in CYGWIN=tty mode. I just tried it three times with notty and it was > worse than before. Pressing the RETURN key doesn't return to the shell prompt anymore. So I will not > check in that until the problem is solved for notty as well. I prepared my fix using NT4.0 SP6, and have since tested it also on win98SE. I always work in an xterm, rather than a cygwin console, and rlogin with my fix works correctly on both machines whether I have CYGWIN=tty or CYGWIN=notty. There appears to be a bug in the cygwin implementation of sigaction() such that using the same address for both the new action and the old results in the new action not being installed. My fix is a work-around for this, and without it I think there is no chance of obtaining correct behaviour from rlogin. I have now tried rlogin from the cygwin console and, as you reported, it fails with CYGWIN=notty. I have traced the problem to the point where the parent process, in function writer(), reads from stdin (line 568). When the child terminates, the call to read returns with n == -1 and errno == EINTR, and then commences an infinite loop at the 'continue' statement. I haven't managed to determine which signal is interrupting the read, but I guess it is not SIGCHLD since in that case the parent process should have terminated correctly. I can fix this in a rough-and-ready way by simply removing the "continue". "On my system" this appears to give correct behavior for tty, notty, xterm and cygwin console. Please consider the patch below and let me know what you think Steve diff -Naur inetutils-1.3.2-7/libinetutils/setsig.c inetutils-1.3.2-steve/libinetutils/setsig.c --- inetutils-1.3.2-7/libinetutils/setsig.c Wed Jul 5 11:44:40 2000 +++ inetutils-1.3.2-steve/libinetutils/setsig.c Mon Oct 2 15:22:12 2000 @@ -42,7 +42,7 @@ sa.sa_flags = SA_RESTART; #endif sa.sa_handler = handler; - sigaction (sig, &sa, &sa); + sigaction (sig, &sa, NULL); return sa.sa_handler; #else /* !HAVE_SIGACTION */ #ifdef HAVE_SIGVEC diff -Naur inetutils-1.3.2-7/rlogin/rlogin.c inetutils-1.3.2-steve/rlogin/rlogin.c --- inetutils-1.3.2-7/rlogin/rlogin.c Wed Jul 5 11:44:42 2000 +++ inetutils-1.3.2-steve/rlogin/rlogin.c Mon Oct 2 15:23:30 2000 @@ -567,8 +567,10 @@ for (;;) { n = read(STDIN_FILENO, &c, 1); if (n <= 0) { +#ifndef __CYGWIN__ if (n < 0 && errno == EINTR) continue; +#endif break; } /* -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com