From owner-freebsd-hackers@FreeBSD.ORG Fri Oct 23 11:08:23 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 17496106566B for ; Fri, 23 Oct 2009 11:08:23 +0000 (UTC) (envelope-from onemda@gmail.com) Received: from mail-ew0-f218.google.com (mail-ew0-f218.google.com [209.85.219.218]) by mx1.freebsd.org (Postfix) with ESMTP id A09068FC13 for ; Fri, 23 Oct 2009 11:08:22 +0000 (UTC) Received: by ewy18 with SMTP id 18so8466100ewy.43 for ; Fri, 23 Oct 2009 04:08:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=53MXkDFeYbOl06N+1CMWYMhEQkhMIytJff5KCkQ0WXc=; b=UJBW2srWWd43xwoxtJxjZnEhVVjNE2GQdms6Bj4mSObrz/wqNnOZKkBhI9PmHVMXhF 8cSVE6tJ3PN1xDnqKgfctWHv8ZJ9yeIGmjwj9OX4C1xM2282bxpj8Ox8Fgqi5lohWcv7 1vpYXg4VCrHCtpulLEzi7iyruc5A3Ipv+oXyY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=RjfUGCkHNr0QSNXuSH6XtSE5wmRFiPYpVYsxId8zud+BGd+j5nGvh3OJwlpcXWH4BQ rey3hVOBjb5JffftmKbsdOjuSwn0YMm+dB7lkvT18Br9YFqXzT2AvEvBQ15k3/0j+S91 sfAlSMzzTp2q0Csph8oRUnaX9cFFCKfPKaS2Q= MIME-Version: 1.0 Received: by 10.210.95.3 with SMTP id s3mr4491453ebb.47.1256296101354; Fri, 23 Oct 2009 04:08:21 -0700 (PDT) In-Reply-To: References: Date: Fri, 23 Oct 2009 11:08:21 +0000 Message-ID: <3a142e750910230408q5aa60bcan1d641bd9e69d96af@mail.gmail.com> From: Paul B Mahol To: Alexander Best Content-Type: text/plain; charset=ISO-8859-1 Cc: Antony Mawer , freebsd-hackers@freebsd.org, Nate Eldredge 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 11:08:23 -0000 On 10/23/09, Alexander Best wrote: > Nate Eldredge schrieb am 2009-10-23: >> On Fri, 23 Oct 2009, Antony Mawer wrote: > >> >On Fri, Oct 23, 2009 at 1:35 PM, Alexander Best >> > wrote: >> >>hi everyone, > >> >>together with hugh mahon (the author of ee) i've been trying to >> >>fix a nasty >> >>bug in ee. for some reason ee exits (not crashes) and leaves the >> >>console >> >>corrupted when receiving SIGWINCH (`killall -SIGWINCH ee` should >> >>exit all >> >>running ee instances). > >> >I noticed this the other day when working on a new 8.0-RC1 system... >> >in my case I was using putty (Windows ssh client) to access the >> >system >> >and maximised the window I had ee running in, and noticed ee just >> >dumped me straight to the prompt. > >> Seems a good start might be to compile ncurses with -g, link ee >> against it, put a breakpoint on the SIGWINCH handler, and start >> single stepping... > >> -- > >> Nate Eldredge >> nate@thatsmathematics.com > > it seems ncurses registers a standard libc function with SIGWINCH. i started > gdb, loaded ee and did "handle SIGWINCH stop" > > when i do "run" and issue a SIGWINCH to ee this is the output: > > Program received signal SIGWINCH, Window size changed. > 0x281a4063 in read () from /lib/libc.so.7 > > (gdb) nexti > 0x281a4048 in write () from /lib/libc.so.7 > (gdb) nexti > 0x281a4049 in write () from /lib/libc.so.7 > (gdb) nexti > 0x281a404e in write () from /lib/libc.so.7 > (gdb) nexti > 0x281a404f in write () from /lib/libc.so.7 > (gdb) nexti > 0x281a4055 in write () from /lib/libc.so.7 > (gdb) nexti > > Program exited normally. > > so i guess ee calls some ncurses function right at the beginning. that > ncurses > function registers a new function to be called upon SIGWINCH (maybe > exit(3)). Hmm, from my little experience with ncurses, there is no such function bind to SIGWINCH. Even if exit() is called from ncurses that's because ncurses can not handle current state in any reasonable way so exiting is only possible solution, but in such case something should be printed and program should not exit normally. If you start another shell command from ee, and let it be for example vim, once you resize xterm window, vim will still work but ee will start to consume CPU time.