From owner-freebsd-hackers@FreeBSD.ORG Fri Oct 23 12:02:40 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5DFBD1065697; Fri, 23 Oct 2009 12:02:40 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id 1A3CA8FC14; Fri, 23 Oct 2009 12:02:39 +0000 (UTC) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id BF32C6D41B; Fri, 23 Oct 2009 12:02:38 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id 9379584509; Fri, 23 Oct 2009 14:02:38 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Alexander Best References: Date: Fri, 23 Oct 2009 14:02:38 +0200 In-Reply-To: (Alexander Best's message of "Fri, 23 Oct 2009 12:42:27 +0200 (CEST)") Message-ID: <86tyxqqpwh.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.95 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: Antony Mawer , freebsd-hackers@freebsd.org, pluknet , ed@freebsd.org, rafan@freebsd.org Subject: Re: help needed to fix contrib/ee crash/exit when receiving SIGWINCH X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Oct 2009 12:02:40 -0000 [cc: ed for ee and rafan for ncurses] Alexander Best writes: > i'm not so sure this is entirely ee's fault. It is *partly* ee's fault. src/usr.bin/ee/ee.c in 7: in =3D wgetch(text_win); if (in =3D=3D -1) continue; src/contrib/ee/ee.c in 8: in =3D wgetch(text_win); if (in =3D=3D -1) exit(0); /* without this exit ee will go into an=20 infinite loop if the network=20 session detaches */ >From the wgetch() man page: Programmers concerned about portability should be prepared for eit= her of two cases: (a) signal receipt does not interrupt getch; (b) sig= nal receipt interrupts getch and causes it to return ERR with errno set = to EINTR. Under the ncurses implementation, handled signals never int= er=E2=80=90 rupt getch. so ee is not portable (it should not assume that a "handled signal" such as SIGWINCH does not interrupt wgetch()), but that's not the real issue. The real issue, though, is that when a SIGWINCH is caught, wgetch() correctly returns KEY_RESIZE, but the next call to wgetch() returns -1. The next call after that is fine. I suspect the error lies somewhere inside kgetch() in contrib/ncurses/ncurses/base/lib_getch.c. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no