From nobody@FreeBSD.org  Sun Jun 29 12:32:03 2008
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 3AA3B106567A
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 29 Jun 2008 12:32:03 +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 9A6BC8FC24
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 29 Jun 2008 12:32:01 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.2/8.14.2) with ESMTP id m5TCW116089874
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 29 Jun 2008 12:32:01 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.2/8.14.1/Submit) id m5TCW1HS089873;
	Sun, 29 Jun 2008 12:32:01 GMT
	(envelope-from nobody)
Message-Id: <200806291232.m5TCW1HS089873@www.freebsd.org>
Date: Sun, 29 Jun 2008 12:32:01 GMT
From: Raid <strldd@strijd.homeunix.net>
To: freebsd-gnats-submit@FreeBSD.org
Subject: ee consume 100% cpu usage 
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         125098
>Category:       bin
>Synopsis:       [patch] ee(1) consume 100% cpu usage
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jun 29 12:40:02 UTC 2008
>Closed-Date:    Fri Nov 02 22:14:22 UTC 2012
>Last-Modified:  Fri Nov 02 22:14:22 UTC 2012
>Originator:     Raid
>Release:        7.0
>Organization:
checkpoint
>Environment:
FreeBSD strijd.homeunix.net 7.0-RELEASE FreeBSD 7.0-RELEASE #0: Sat May 31 12:35                                             :09 IDT 2008     raid@strijd.homeunix.net:/usr/src/sys/i386/compile/SERVER  i386

>Description:
When using "ee" and closing session (not logging out, but closing session using putty) ee consumes 100% cpu usage

>How-To-Repeat:
logging using putty via ssh 
type : ee or simply ee file 
close session manually
then logging again 
type : top 
 
>Fix:


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-i386->freebsd-bugs 
Responsible-Changed-By: remko 
Responsible-Changed-When: Sun Jun 29 13:26:41 UTC 2008 
Responsible-Changed-Why:  
This looks like something globally, reassign to -bugs 

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

From: Raid <strldd@strijd.homeunix.net>
To: bug-followup@FreeBSD.org, strldd@strijd.homeunix.net
Cc:  
Subject: Re: bin/125098: ee(1) consume 100% cpu usage
Date: Tue, 01 Jul 2008 10:12:43 +0300

 Note : must be root
 

From: Jaakko Heinonen <jh@saunalahti.fi>
To: bug-followup@FreeBSD.org, strldd@strijd.homeunix.net
Cc:  
Subject: Re: bin/125098: ee(1) consume 100% cpu usage
Date: Tue, 1 Jul 2008 15:31:36 +0300

 --pf9I7BMVVzbSWLtt
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 
 
 This is similar to the bug bin/107171 seen in systat(1). The bug happens
 because after closing the terminal subsequent wgetch() calls fail but
 ee(1) ignores errors and thus hangs to infinite loop. Normally ee(1)
 dies correctly on terminal close when it receives SIGHUP. However when
 you run it as different user (root) it doesn't receive SIGHUP.
 
 Attached patch should fix the problem.
 
 -- 
 Jaakko
 
 --pf9I7BMVVzbSWLtt
 Content-Type: text/x-diff; charset=us-ascii
 Content-Disposition: attachment; filename="ee-hang-on-getch.diff"
 
 Index: usr.bin/ee/ee.c
 ===================================================================
 --- usr.bin/ee/ee.c	(revision 180121)
 +++ usr.bin/ee/ee.c	(working copy)
 @@ -622,7 +622,10 @@
  		doupdate();
  		in = wgetch(text_win);
  		if (in == -1)
 -			continue;
 +			if (errno == EINTR)
 +				continue;
 +			else
 +				edit_abort(0);
  
  		resize_check();
  
 @@ -1869,7 +1872,10 @@
  		esc_flag = FALSE;
  		in = wgetch(com_win);
  		if (in == -1)
 -			continue;
 +			if (errno == EINTR)
 +				continue;
 +			else
 +				edit_abort(0);
  		if (((in == 8) || (in == 127) || (in == KEY_BACKSPACE)) && (g_pos > 0))
  		{
  			tmp_int = g_horz;
 @@ -1894,7 +1900,10 @@
  				esc_flag = TRUE;
  				in = wgetch(com_win);
  				if (in == -1)
 -					continue;
 +					if (errno == EINTR)
 +						continue;
 +					else
 +						edit_abort(0);
  			}
  			*nam_str = in;
  			g_pos++;
 @@ -3386,6 +3395,11 @@
  
  		wrefresh(temp_win);
  		input = wgetch(temp_win);
 +		if (input == -1)
 +			if (errno == EINTR)
 +				continue;
 +			else
 +				edit_abort(0);
  
  		if (((tolower(input) >= 'a') && (tolower(input) <= 'z')) || 
  		    ((input >= '0') && (input <= '9')))
 
 --pf9I7BMVVzbSWLtt--
State-Changed-From-To: open->patched 
State-Changed-By: gavin 
State-Changed-When: Tue Jun 2 14:31:29 UTC 2009 
State-Changed-Why:  
This is apparently fixed by the import of ee 1.5.0 into HEAD. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=125098 
State-Changed-From-To: patched->closed 
State-Changed-By: eadler 
State-Changed-When: Fri Nov 2 22:14:21 UTC 2012 
State-Changed-Why:  
fixed in head in 2009 so its likely fixed by now 

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