bin/125098: ee(1) consume 100% cpu usage
Jaakko Heinonen
jh at saunalahti.fi
Tue Jul 1 12:40:04 UTC 2008
The following reply was made to PR bin/125098; it has been noted by GNATS.
From: Jaakko Heinonen <jh at saunalahti.fi>
To: bug-followup at FreeBSD.org, strldd at 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--
More information about the freebsd-bugs
mailing list