From nobody@FreeBSD.org  Wed Jul  1 16:50:57 2009
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 4D0171065670
	for <freebsd-gnats-submit@FreeBSD.org>; Wed,  1 Jul 2009 16:50:57 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id 3B9748FC19
	for <freebsd-gnats-submit@FreeBSD.org>; Wed,  1 Jul 2009 16:50:57 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id n61Gou2Q020757
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 1 Jul 2009 16:50:56 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id n61Gou2A020756;
	Wed, 1 Jul 2009 16:50:56 GMT
	(envelope-from nobody)
Message-Id: <200907011650.n61Gou2A020756@www.freebsd.org>
Date: Wed, 1 Jul 2009 16:50:56 GMT
From: Alexander Best <alexbestms@math.uni-muenster.de>
To: freebsd-gnats-submit@FreeBSD.org
Subject: ee doesn't handle SIGWINCH
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         136223
>Category:       bin
>Synopsis:       ee(1) doesn't handle SIGWINCH
>Confidential:   no
>Severity:       non-critical
>Priority:       high
>Responsible:    rafan
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jul 01 17:00:09 UTC 2009
>Closed-Date:    Mon Apr 26 14:39:25 UTC 2010
>Last-Modified:  Mon Apr 26 14:39:25 UTC 2010
>Originator:     Alexander Best
>Release:        8.0-CURRENT
>Organization:
>Environment:
FreeBSD moshnroll 8.0-CURRENT FreeBSD 8.0-CURRENT #5 r195173M: Mon Jun 29 22:11:48 CEST 2009     root@moshnroll:/usr/obj/usr/src/sys/ARUNDEL  i386
>Description:
when having ee running in an xterm and opening another xterm window ee exits. if running ee in gdb it says: "Program exited normally".

i talked to Paul B. Mahol (onemda at gmail dot com) over at freebsd-questions@ and he believes this to be a bug in ee. this is his analysis of the problem:

"Problems is that ee doesnt handle SIGWINCH properly.
ee on FreeBSD is linked with ncurses but new_curse.c from contrib/ee is
only file that mentions SIGWINCH and that file is not part of
usr.bin/ee/Makefile"

i'm running:
xorg-7.4.2
x11-wm/awesome

cheers.
>How-To-Repeat:
have ee runnning in an xterm and either open another xterm or resize an existing one.
>Fix:


>Release-Note:
>Audit-Trail:

From: Alexander Best <alexbestms@math.uni-muenster.de>
To: <bug-followup@FreeBSD.org>
Cc:  
Subject: Re: bin/136223: ee(1) doesn't handle SIGWINCH
Date: Fri, 24 Jul 2009 02:49:44 +0200 (CEST)

 what's the status of this PR? i think it really should be fixed before
 8.0-RELEASE, because it's really frustrating to lose ee's contents everytime a
 window gets opened or resized. this will definitely put off user new to
 freebsd. shipping an OS with a "broken" editor is pretty much unacceptable.
 
 alex

From: Alexander Best <alexbestms@math.uni-muenster.de>
To: <bug-followup@FreeBSD.org>
Cc:  
Subject: Re: bin/136223: ee(1) doesn't handle SIGWINCH
Date: Fri, 23 Oct 2009 18:41:50 +0200 (CEST)

 problem is currently being discussed in this thread:
 http://lists.freebsd.org/pipermail/freebsd-hackers/2009-October/029796.html
 
 Eygene Ryabinkin proposed a patch in this post:
 http://lists.freebsd.org/pipermail/freebsd-hackers/2009-October/029818.html
 
 i can confirm that the patch solves the problem.
 
 alex

From: Eygene Ryabinkin <rea-fbsd@codelabs.ru>
To: bug-followup@freebsd.org
Cc:  
Subject: Re: bin/136223: ee(1) doesn't handle SIGWINCH
Date: Sat, 24 Oct 2009 15:31:19 +0400

 Put the patch to the Web for the easiness:
   http://codelabs.ru/fbsd/patches/ncurses/ncurses-properly-handle-SIGWINCH.diff
 -- 
 Eygene
  _                ___       _.--.   #
  \`.|\..----...-'`   `-._.-'_.-'`   #  Remember that it is hard
  /  ' `         ,       __.--'      #  to read the on-line manual
  )/' _/     \   `-_,   /            #  while single-stepping the kernel.
  `-'" `"\_  ,_.-;_.-\_ ',  fsc/as   #
      _.-'_./   {_.'   ; /           #    -- FreeBSD Developers handbook
     {_.-``-'         {_/            #
Responsible-Changed-From-To: freebsd-bugs->rafan 
Responsible-Changed-By: rafan 
Responsible-Changed-When: Mon Oct 26 13:04:16 UTC 2009 
Responsible-Changed-Why:  
I'll take it. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=136223 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/136223: commit references a PR
Date: Mon, 26 Oct 2009 13:01:41 +0000 (UTC)

 Author: rafan
 Date: Mon Oct 26 13:01:29 2009
 New Revision: 198489
 URL: http://svn.freebsd.org/changeset/base/198489
 
 Log:
   Pull upstream patch to fix ee(1) crash when received SIGWINCH:
   
     modify _nc_wgetch() to check for a -1 in the fifo, e.g., after a
     SIGWINCH, and discard that value, to avoid confusing application
     (patch by Eygene Ryabinkin, FreeBSD bin/136223).
   
   PR:		136223
   Submitted by:	Eygene Ryabinkin
   Obtained from:	ncurses-5.7-20091024 snapshot
   MFC after:	3 days
 
 Modified:
   vendor/ncurses/dist/ncurses/base/lib_getch.c
 
 Modified: vendor/ncurses/dist/ncurses/base/lib_getch.c
 ==============================================================================
 --- vendor/ncurses/dist/ncurses/base/lib_getch.c	Mon Oct 26 11:26:49 2009	(r198488)
 +++ vendor/ncurses/dist/ncurses/base/lib_getch.c	Mon Oct 26 13:01:29 2009	(r198489)
 @@ -476,6 +476,12 @@ _nc_wgetch(WINDOW *win,
  	    /* resizeterm can push KEY_RESIZE */
  	    if (cooked_key_in_fifo()) {
  		*result = fifo_pull(sp);
 +		/*
 +		 * Get the ERR from queue -- it is from WINCH,
 +		 * so we should take it out, the "error" is handled.
 +		 */
 +		if (fifo_peek(sp) == -1)
 +		    fifo_pull(sp);
  		returnCode(*result >= KEY_MIN ? KEY_CODE_YES : OK);
  	    }
  	}
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/136223: commit references a PR
Date: Mon, 26 Oct 2009 13:04:01 +0000 (UTC)

 Author: rafan
 Date: Mon Oct 26 13:03:52 2009
 New Revision: 198490
 URL: http://svn.freebsd.org/changeset/base/198490
 
 Log:
   Merge r198489 from vendor/ncurses/dist:
   
    Pull upstream patch to fix ee(1) crash when received SIGWINCH:
   
      modify _nc_wgetch() to check for a -1 in the fifo, e.g., after a
      SIGWINCH, and discard that value, to avoid confusing application
      (patch by Eygene Ryabinkin, FreeBSD bin/136223).
   
   PR:		136223
   Submitted by:	Eygene Ryabinkin
   Obtained from:	ncurses-5.7-20091024 snapshot
   MFC after:	3 days
 
 Modified:
   head/contrib/ncurses/   (props changed)
   head/contrib/ncurses/ncurses/base/lib_getch.c
 
 Modified: head/contrib/ncurses/ncurses/base/lib_getch.c
 ==============================================================================
 --- head/contrib/ncurses/ncurses/base/lib_getch.c	Mon Oct 26 13:01:29 2009	(r198489)
 +++ head/contrib/ncurses/ncurses/base/lib_getch.c	Mon Oct 26 13:03:52 2009	(r198490)
 @@ -476,6 +476,12 @@ _nc_wgetch(WINDOW *win,
  	    /* resizeterm can push KEY_RESIZE */
  	    if (cooked_key_in_fifo()) {
  		*result = fifo_pull(sp);
 +		/*
 +		 * Get the ERR from queue -- it is from WINCH,
 +		 * so we should take it out, the "error" is handled.
 +		 */
 +		if (fifo_peek(sp) == -1)
 +		    fifo_pull(sp);
  		returnCode(*result >= KEY_MIN ? KEY_CODE_YES : OK);
  	    }
  	}
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: open->patched 
State-Changed-By: linimon 
State-Changed-When: Wed Oct 28 02:42:52 UTC 2009 
State-Changed-Why:  
change has been committed. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=136223 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/136223: commit references a PR
Date: Fri, 30 Oct 2009 17:28:54 +0000 (UTC)

 Author: rafan
 Date: Fri Oct 30 17:28:35 2009
 New Revision: 198693
 URL: http://svn.freebsd.org/changeset/base/198693
 
 Log:
   MFC r198490
   
    Pull upstream patch to fix ee(1) crash when received SIGWINCH:
   
      modify _nc_wgetch() to check for a -1 in the fifo, e.g., after a
      SIGWINCH, and discard that value, to avoid confusing application
      (patch by Eygene Ryabinkin, FreeBSD bin/136223).
   
   PR:		136223
   Submitted by:	Eygene Ryabinkin
   Obtained from:	ncurses-5.7-20091024 snapshot
 
 Modified:
   stable/8/contrib/ncurses/   (props changed)
   stable/8/contrib/ncurses/ncurses/base/lib_getch.c
 
 Modified: stable/8/contrib/ncurses/ncurses/base/lib_getch.c
 ==============================================================================
 --- stable/8/contrib/ncurses/ncurses/base/lib_getch.c	Fri Oct 30 16:59:58 2009	(r198692)
 +++ stable/8/contrib/ncurses/ncurses/base/lib_getch.c	Fri Oct 30 17:28:35 2009	(r198693)
 @@ -476,6 +476,12 @@ _nc_wgetch(WINDOW *win,
  	    /* resizeterm can push KEY_RESIZE */
  	    if (cooked_key_in_fifo()) {
  		*result = fifo_pull(sp);
 +		/*
 +		 * Get the ERR from queue -- it is from WINCH,
 +		 * so we should take it out, the "error" is handled.
 +		 */
 +		if (fifo_peek(sp) == -1)
 +		    fifo_pull(sp);
  		returnCode(*result >= KEY_MIN ? KEY_CODE_YES : OK);
  	    }
  	}
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/136223: commit references a PR
Date: Sat, 31 Oct 2009 12:58:23 +0000 (UTC)

 Author: rafan
 Date: Sat Oct 31 12:58:13 2009
 New Revision: 198716
 URL: http://svn.freebsd.org/changeset/base/198716
 
 Log:
   MFC r198490
   
    Pull upstream patch to fix ee(1) crash when received SIGWINCH:
   
      modify _nc_wgetch() to check for a -1 in the fifo, e.g., after a
      SIGWINCH, and discard that value, to avoid confusing application
      (patch by Eygene Ryabinkin, FreeBSD bin/136223).
   
   PR:		136223
   Submitted by:	Eygene Ryabinkin
   Obtained from:	ncurses-5.7-20091024 snapshot
   Approved by:	re (kib@)
 
 Modified:
   releng/8.0/contrib/ncurses/   (props changed)
   releng/8.0/contrib/ncurses/ncurses/base/lib_getch.c
 
 Modified: releng/8.0/contrib/ncurses/ncurses/base/lib_getch.c
 ==============================================================================
 --- releng/8.0/contrib/ncurses/ncurses/base/lib_getch.c	Sat Oct 31 12:26:40 2009	(r198715)
 +++ releng/8.0/contrib/ncurses/ncurses/base/lib_getch.c	Sat Oct 31 12:58:13 2009	(r198716)
 @@ -476,6 +476,12 @@ _nc_wgetch(WINDOW *win,
  	    /* resizeterm can push KEY_RESIZE */
  	    if (cooked_key_in_fifo()) {
  		*result = fifo_pull(sp);
 +		/*
 +		 * Get the ERR from queue -- it is from WINCH,
 +		 * so we should take it out, the "error" is handled.
 +		 */
 +		if (fifo_peek(sp) == -1)
 +		    fifo_pull(sp);
  		returnCode(*result >= KEY_MIN ? KEY_CODE_YES : OK);
  	    }
  	}
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: patched->closed 
State-Changed-By: rafan 
State-Changed-When: Mon Apr 26 14:39:23 UTC 2010 
State-Changed-Why:  
Problem does not exist in 7. Both 8.x and CURRENT had the fix committed 
last year. Close. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=136223 
>Unformatted:
