help needed to fix contrib/ee crash/exit when receiving SIGWINCH
since you've tested the patch on 7-stable do think it's mature enough to be committed to that branch? alex ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org
Re: help needed to fix contrib/ee crash/exit when receiving SIGWINCH
Eygene Ryabinkin schrieb am 2009-11-03: Mon, Nov 02, 2009 at 10:32:29PM +0100, Alexander Best wrote: ok. the pr stays in patched state. right now the patch is in HEAD, 8-STABLE and 8.0-RELEASE. rafan is thinking about mfc'ing the patch to 6-stable and 7-stable. however if somebody is willing to modify the patch so it applies to those branches that'll be great Patch applies cleanly to the 7-STABLE, moreover, lib_getch.c from it has the same logics and fifo_push is essentially unmodified in the areas that are relevant for this flaw. I had patched 7-STABLE on the test machine, brought ee from 8.x and verified that unpatched ncurses give immediate exit, while patched curses give working ee in respect to the SIGWINCH. I had also mildly tested vi and sysinstall on the patched 7-STABLE and found no visible regressions. great. so do we need/want the patch in 6.x? alex ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org
Re: help needed to fix contrib/ee crash/exit when receiving SIGWINCH
Dag-Erling Smørgrav schrieb am 2009-11-01: Alexander Best alexbes...@math.uni-muenster.de writes: great news. so should the PR be closed or should it remain in patched state in order for 7.x to get patched? Set it to patched until you've merged the patch to 6, 7 and 8 (IIRC, 6 has the new ncurses as well) ok. the pr stays in patched state. right now the patch is in HEAD, 8-STABLE and 8.0-RELEASE. rafan is thinking about mfc'ing the patch to 6-stable and 7-stable. however if somebody is willing to modify the patch so it applies to those branches that'll be great another question: how about our ncurses base version in general? should it remain the ncurses release version with our own patchset or would it be better to update it more frequently with the official ncurses patchsets? i guess this is the way acpi in the base dir is being handled. vendor updates get integrated on the fly into the base dir. I would just import releases, unless there is a compelling reason to import a patchset (i.e. it fixes a serious bug and we can't easily apply just that one patch). my thoughts exactly. ncurses in the base dir is quite up to date. however i personally think that other contributed software should really be updated (binutils e.g.). but that's another story. ;) DES ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org
Re: help needed to fix contrib/ee crash/exit when receiving SIGWINCH
Mon, Nov 02, 2009 at 10:32:29PM +0100, Alexander Best wrote: ok. the pr stays in patched state. right now the patch is in HEAD, 8-STABLE and 8.0-RELEASE. rafan is thinking about mfc'ing the patch to 6-stable and 7-stable. however if somebody is willing to modify the patch so it applies to those branches that'll be great Patch applies cleanly to the 7-STABLE, moreover, lib_getch.c from it has the same logics and fifo_push is essentially unmodified in the areas that are relevant for this flaw. I had patched 7-STABLE on the test machine, brought ee from 8.x and verified that unpatched ncurses give immediate exit, while patched curses give working ee in respect to the SIGWINCH. I had also mildly tested vi and sysinstall on the patched 7-STABLE and found no visible regressions. -- Eygene ____ _.--. # \`.|\.....-'` `-._.-'_.-'` # Remember that it is hard / ' ` , __.--' # to read the on-line manual )/' _/ \ `-_, /# while single-stepping the kernel. `-' `\_ ,_.-;_.-\_ ', fsc/as # _.-'_./ {_.' ; / #-- FreeBSD Developers handbook {_.-``-' {_/# ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org
Re: help needed to fix contrib/ee crash/exit when receiving SIGWINCH
Alexander Best alexbes...@math.uni-muenster.de writes: great news. so should the PR be closed or should it remain in patched state in order for 7.x to get patched? Set it to patched until you've merged the patch to 6, 7 and 8 (IIRC, 6 has the new ncurses as well) another question: how about our ncurses base version in general? should it remain the ncurses release version with our own patchset or would it be better to update it more frequently with the official ncurses patchsets? i guess this is the way acpi in the base dir is being handled. vendor updates get integrated on the fly into the base dir. I would just import releases, unless there is a compelling reason to import a patchset (i.e. it fixes a serious bug and we can't easily apply just that one patch). DES -- Dag-Erling Smørgrav - d...@des.no ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org
Re: help needed to fix contrib/ee crash/exit when receiving SIGWINCH
Dag-Erling Smørgrav schrieb am 2009-10-26: Alexander Best alexbes...@math.uni-muenster.de writes: the patch got committed by thomas and is included in ncurses-5.7-20091024.patch.gz. i guess it will be included in our base version of ncurses once 5.8 gets released, but the patch should quickly make it into the port version of ncurses. Apply the upstream patch to vendor/ncurses/dist and merge it to head. Subversion will DTRT when you import 5.8. I believe this is documented on the wiki. DES great news. so should the PR be closed or should it remain in patched state in order for 7.x to get patched? another question: how about our ncurses base version in general? should it remain the ncurses release version with our own patchset or would it be better to update it more frequently with the official ncurses patchsets? i guess this is the way acpi in the base dir is being handled. vendor updates get integrated on the fly into the base dir. on the other hand acpi isn't in the ports dir. if one needs cutting edge ncurses there's devel/ncurses-devel. so there's a reason to only to update the base version of ncurses when a new release is happening (5.8 e.g.). what's your opinion? alex ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org
Re: help needed to fix contrib/ee crash/exit when receiving SIGWINCH
Dag-Erling Smørgrav schrieb am 2009-10-26: Rong-En Fan ra...@freebsd.org writes: devel/ncurses-devel will be updated this week. For base's ncurses, I'll check with Thomas Dickey to see if there will be 5.8 soon. If not, we can also import a recent snapshot. There is no reason to wait, nor to import an entire snapshot. Se my earlier message to Alexander. DES rafan just mfc'ed the patch. could we also have the fix in 8.0-RELEASE? should get approved by r...@. alex ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org
Re: help needed to fix contrib/ee crash/exit when receiving SIGWINCH
Eygene Ryabinkin schrieb am 2009-10-24: Ed, good day. Fri, Oct 23, 2009 at 07:13:01PM +0200, Ed Schouten wrote: Have you sent it to Thomas Dickey as well? Sent the patch to bug-ncur...@gnu.org. Do you think that I should send it to Thomas directly as well? the patch got committed by thomas and is included in ncurses-5.7-20091024.patch.gz. i guess it will be included in our base version of ncurses once 5.8 gets released, but the patch should quickly make it into the port version of ncurses. alex ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org
Re: help needed to fix contrib/ee crash/exit when receiving SIGWINCH
Dag-Erling Smørgrav schrieb am 2009-10-25: Alexander Best alexbes...@math.uni-muenster.de writes: i just tried building ee under linux without using new_curse.c and linking the executable against ncurses. running the binary is showing the same problems with SIGWINCH. so if this is in fact caused by a ncurses bug the bug appears in linux ncurses too. No surprise, it's the same as ours. DES this was when we weren't sure if the problem was entirely ncurses-related. could have also been that linux was including the ncurses patches which get released by thomas dickey every now and then. i'm not entirely sure but i think the version in the base dir we use is the unpatched 5.7 release of ncurses. alex ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org
Re: help needed to fix contrib/ee crash/exit when receiving SIGWINCH
On Mon, Oct 26, 2009 at 11:44:14AM +0100, Alexander Best wrote: Eygene Ryabinkin schrieb am 2009-10-24: Ed, good day. Fri, Oct 23, 2009 at 07:13:01PM +0200, Ed Schouten wrote: Have you sent it to Thomas Dickey as well? Sent the patch to bug-ncur...@gnu.org. Do you think that I should send it to Thomas directly as well? the patch got committed by thomas and is included in ncurses-5.7-20091024.patch.gz. i guess it will be included in our base version of ncurses once 5.8 gets released, but the patch should quickly make it into the port version of ncurses. devel/ncurses-devel will be updated this week. For base's ncurses, I'll check with Thomas Dickey to see if there will be 5.8 soon. If not, we can also import a recent snapshot. Thanks, Rong-En Fan pgp0ojXYkOoIt.pgp Description: PGP signature
Re: help needed to fix contrib/ee crash/exit when receiving SIGWINCH
Rong-En Fan ra...@freebsd.org writes: devel/ncurses-devel will be updated this week. For base's ncurses, I'll check with Thomas Dickey to see if there will be 5.8 soon. If not, we can also import a recent snapshot. There is no reason to wait, nor to import an entire snapshot. Se my earlier message to Alexander. DES -- Dag-Erling Smørgrav - d...@des.no ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org
Re: help needed to fix contrib/ee crash/exit when receiving SIGWINCH
Alexander Best alexbes...@math.uni-muenster.de writes: i just tried building ee under linux without using new_curse.c and linking the executable against ncurses. running the binary is showing the same problems with SIGWINCH. so if this is in fact caused by a ncurses bug the bug appears in linux ncurses too. No surprise, it's the same as ours. DES -- Dag-Erling Smørgrav - d...@des.no ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org
Re: help needed to fix contrib/ee crash/exit when receiving SIGWINCH
Hy Eygene, * Eygene Ryabinkin rea-f...@codelabs.ru wrote: Sent the patch to bug-ncur...@gnu.org. Do you think that I should send it to Thomas directly as well? Probably not. bug-ncurses@ should be good enough. Thanks! -- Ed Schouten e...@80386.nl WWW: http://80386.nl/ pgp38kOKPpvEE.pgp Description: PGP signature
Re: help needed to fix contrib/ee crash/exit when receiving SIGWINCH
On Fri, Oct 23, 2009 at 07:56:35PM +0400, Eygene Ryabinkin wrote: Hmm, we can transform this code to the following one: - errno = 0; do { in = wgetch(text_win); } while (errno == EINTR); if (in == -1) exit(0); - This won't help with FreeBSD's ncurses, but may be other variants will feel much better with such a event loop variant. That should be: - do in = wgetch(text_win); while (in == -1 errno == EINTR); if (in == -1) exit(0); - errno should only be checked after failed function calls or for functions where it is documented that errno should be used to check for error conditions (example: readdir). -- Jilles Tjoelker ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org
Re: help needed to fix contrib/ee crash/exit when receiving SIGWINCH
Sat, Oct 24, 2009 at 02:04:34PM +0200, Jilles Tjoelker wrote: That should be: - do in = wgetch(text_win); while (in == -1 errno == EINTR); if (in == -1) exit(0); - errno should only be checked after failed function calls or for functions where it is documented that errno should be used to check for error conditions (example: readdir). True, thanks for correction! -- Eygene ____ _.--. # \`.|\.....-'` `-._.-'_.-'` # Remember that it is hard / ' ` , __.--' # to read the on-line manual )/' _/ \ `-_, /# while single-stepping the kernel. `-' `\_ ,_.-;_.-\_ ', fsc/as # _.-'_./ {_.' ; / #-- FreeBSD Developers handbook {_.-``-' {_/# ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org
Re: help needed to fix contrib/ee crash/exit when receiving SIGWINCH
2009/10/23 Antony Mawer li...@mawer.org: On Fri, Oct 23, 2009 at 1:35 PM, Alexander Best alexbes...@math.uni-muenster.de 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. I am wondering if this has anything to do with the new tty subsystem in 8.0, as this wasn't a problem I've experienced before under 7.x... No, that's a regression appeared in (FreeBSD'ish? version of) ee 1.5.0. -- wbr, pluknet ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org
Re: help needed to fix contrib/ee crash/exit when receiving SIGWINCH
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 alexbes...@math.uni-muenster.de 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 n...@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)). cheers. alex ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org
Re: help needed to fix contrib/ee crash/exit when receiving SIGWINCH
pluknet schrieb am 2009-10-23: 2009/10/23 Antony Mawer li...@mawer.org: On Fri, Oct 23, 2009 at 1:35 PM, Alexander Best alexbes...@math.uni-muenster.de 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. I am wondering if this has anything to do with the new tty subsystem in 8.0, as this wasn't a problem I've experienced before under 7.x... No, that's a regression appeared in (FreeBSD'ish? version of) ee 1.5.0. i'm not so sure this is entirely ee's fault. i just grabbed a really ancient version of ee from http://www.anerd.org/sources/ (ee-1.4.2.src.tgz last modified Jan 2001). yet i see the very same behaviour as with ee 1.5.0. right now it looks more like a tty or ncurses bug. cheers. alex ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org
Re: help needed to fix contrib/ee crash/exit when receiving SIGWINCH
On 10/23/09, Alexander Best alexbes...@math.uni-muenster.de 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 alexbes...@math.uni-muenster.de 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 n...@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. ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org
Re: help needed to fix contrib/ee crash/exit when receiving SIGWINCH
On Fri, 23 Oct 2009 12:58:43 +0400 pluknet pluk...@gmail.com wrote: 2009/10/23 Antony Mawer li...@mawer.org: On Fri, Oct 23, 2009 at 1:35 PM, Alexander Best alexbes...@math.uni-muenster.de 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. I am wondering if this has anything to do with the new tty subsystem in 8.0, as this wasn't a problem I've experienced before under 7.x... No, that's a regression appeared in (FreeBSD'ish? version of) ee 1.5.0. SIGWINCH is handled in new_curse.c, but it's not being compiled/linked. --- Gary Jennejohn ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org
Re: help needed to fix contrib/ee crash/exit when receiving SIGWINCH
On Fri, 23 Oct 2009 13:50:24 +0200 Gary Jennejohn gary.jennej...@freenet.de wrote: On Fri, 23 Oct 2009 12:58:43 +0400 pluknet pluk...@gmail.com wrote: 2009/10/23 Antony Mawer li...@mawer.org: On Fri, Oct 23, 2009 at 1:35 PM, Alexander Best alexbes...@math.uni-muenster.de 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. I am wondering if this has anything to do with the new tty subsystem in 8.0, as this wasn't a problem I've experienced before under 7.x... No, that's a regression appeared in (FreeBSD'ish? version of) ee 1.5.0. SIGWINCH is handled in new_curse.c, but it's not being compiled/linked. Never mind - I see that new_curse.c is supposed to be a substitute for ncurses if it's not available on the system. Sorry for the noise. --- Gary Jennejohn ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org
Re: help needed to fix contrib/ee crash/exit when receiving SIGWINCH
[cc: ed for ee and rafan for ncurses] Alexander Best alexbes...@math.uni-muenster.de 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 = wgetch(text_win); if (in == -1) continue; src/contrib/ee/ee.c in 8: in = wgetch(text_win); if (in == -1) exit(0); /* without this exit ee will go into an infinite loop if the network session detaches */ From the wgetch() man page: Programmers concerned about portability should be prepared for either of two cases: (a) signal receipt does not interrupt getch; (b) signal receipt interrupts getch and causes it to return ERR with errno set to EINTR. Under the ncurses implementation, handled signals never inter‐ 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 -- Dag-Erling Smørgrav - d...@des.no ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org
Re: help needed to fix contrib/ee crash/exit when receiving SIGWINCH
Gary Jennejohn schrieb am 2009-10-23: On Fri, 23 Oct 2009 12:58:43 +0400 pluknet pluk...@gmail.com wrote: 2009/10/23 Antony Mawer li...@mawer.org: On Fri, Oct 23, 2009 at 1:35 PM, Alexander Best alexbes...@math.uni-muenster.de 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. I am wondering if this has anything to do with the new tty subsystem in 8.0, as this wasn't a problem I've experienced before under 7.x... No, that's a regression appeared in (FreeBSD'ish? version of) ee 1.5.0. SIGWINCH is handled in new_curse.c, but it's not being compiled/linked. --- Gary Jennejohn i think that file is only used on systems which have termio.h/sgtty.h and ee doesn't get linked against ncurses. on those systems (linux e.g.) new_curse.c is used to handle certain things which ncurses takes care under freebsd. this is under freebsd: `make`: Neither termio.h or sgtty.h are on this system! Relying on local curses implementation. Generating make.local make -f make.local cc ee.c -o ee -ggdb -DDIAG -DHAS_UNISTD -DHAS_STDARG -DHAS_STDLIB -DHAS_CTYPE -DHAS_SYS_IOCTL -DHAS_SYS_WAIT -DSLCT_HDR -DTERMCAP=\/usr/share/misc/termcap\ -lcursesw `ldd ee`: libncursesw.so.8 = /lib/libncursesw.so.8 (0x2809b000) libc.so.7 = /lib/libc.so.7 (0x280e9000) and under linux: `make`: Generating make.local make -f make.local make[1]: Entering directory `/easyedit-test' cc -c ee.c -DSYS5 -DBSD_SELECT -DNCURSE -DHAS_UNISTD -DHAS_STDLIB -DHAS_CTYPE -DHAS_SYS_IOCTL -DHAS_SYS_WAIT -DSLCT_HDR -s cc new_curse.c -c -DSYS5 -DBSD_SELECT -DNCURSE -DHAS_UNISTD -DHAS_STDLIB -DHAS_CTYPE -DHAS_SYS_IOCTL -DHAS_SYS_WAIT -DSLCT_HDR -s cc -o ee ee.o new_curse.o -DHAS_UNISTD -DHAS_STDLIB -DHAS_CTYPE -DHAS_SYS_IOCTL -DHAS_SYS_WAIT -DSLCT_HDR -s make[1]: Leaving directory `/easyedit-test' `ldd ee`: libc.so.6 = /lib/libc.so.6 (0x2807a000) /lib/ld-linux.so.2 (0x2805b000) alex ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org
Re: help needed to fix contrib/ee crash/exit when receiving SIGWINCH
Gary Jennejohn schrieb am 2009-10-23: On Fri, 23 Oct 2009 12:58:43 +0400 pluknet pluk...@gmail.com wrote: 2009/10/23 Antony Mawer li...@mawer.org: On Fri, Oct 23, 2009 at 1:35 PM, Alexander Best alexbes...@math.uni-muenster.de 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. I am wondering if this has anything to do with the new tty subsystem in 8.0, as this wasn't a problem I've experienced before under 7.x... No, that's a regression appeared in (FreeBSD'ish? version of) ee 1.5.0. SIGWINCH is handled in new_curse.c, but it's not being compiled/linked. --- Gary Jennejohn i just tried building ee under linux without using new_curse.c and linking the executable against ncurses. running the binary is showing the same problems with SIGWINCH. so if this is in fact caused by a ncurses bug the bug appears in linux ncurses too. alex ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org
Re: help needed to fix contrib/ee crash/exit when receiving SIGWINCH
2009/10/23 Alexander Best alexbes...@math.uni-muenster.de: Gary Jennejohn schrieb am 2009-10-23: On Fri, 23 Oct 2009 12:58:43 +0400 pluknet pluk...@gmail.com wrote: 2009/10/23 Antony Mawer li...@mawer.org: On Fri, Oct 23, 2009 at 1:35 PM, Alexander Best alexbes...@math.uni-muenster.de 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. I am wondering if this has anything to do with the new tty subsystem in 8.0, as this wasn't a problem I've experienced before under 7.x... No, that's a regression appeared in (FreeBSD'ish? version of) ee 1.5.0. SIGWINCH is handled in new_curse.c, but it's not being compiled/linked. --- Gary Jennejohn i think that file is only used on systems which have termio.h/sgtty.h and ee doesn't get linked against ncurses. on those systems (linux e.g.) new_curse.c is used to handle certain things which ncurses takes care under freebsd. this is under freebsd: `make`: Neither termio.h or sgtty.h are on this system! Relying on local curses implementation. Generating make.local make -f make.local cc ee.c -o ee -ggdb -DDIAG -DHAS_UNISTD -DHAS_STDARG -DHAS_STDLIB -DHAS_CTYPE -DHAS_SYS_IOCTL -DHAS_SYS_WAIT -DSLCT_HDR -DTERMCAP=\/usr/share/misc/termcap\ -lcursesw `ldd ee`: libncursesw.so.8 = /lib/libncursesw.so.8 (0x2809b000) libc.so.7 = /lib/libc.so.7 (0x280e9000) [Probably already mentioned.] btw, ee compiled under fbsd with new_curse.c (and not linked with curses/cursesw) goes fine with SIGWINCH. --- Makefile.old2009-10-23 16:13:45.0 +0400 +++ Makefile2009-10-23 16:30:03.0 +0400 @@ -3,15 +3,14 @@ .PATH: ${.CURDIR}/../../contrib/ee CFLAGS+= -DHAS_NCURSES -DHAS_UNISTD -DHAS_STDARG -DHAS_STDLIB \ --DHAS_SYS_WAIT +-DHAS_SYS_WAIT -DCAP -DNCURSE PROG= ee +SRCS= ee.c new_curse.c LINKS= ${BINDIR}/ee ${BINDIR}/ree ${BINDIR}/ee ${BINDIR}/edit MLINKS=ee.1 ree.1 ee.1 edit.1 -DPADD= ${LIBNCURSES} -LDADD= -lncurses -WARNS?=2 +WARNS?=0 NLS= en_US.US-ASCII fr_FR.ISO8859-1 de_DE.ISO8859-1 pl_PL.ISO8859-2 \ uk_UA.KOI8-U ru_RU.KOI8-R hu_HU.ISO8859-2 $ ldd ./ee ./ee: libc.so.6 = /lib/libc.so.6 (0x2808a000) (yes, it's FreeBSD 6.x). -- wbr, pluknet ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org
Re: help needed to fix contrib/ee crash/exit when receiving SIGWINCH
pluknet schrieb am 2009-10-23: 2009/10/23 Alexander Best alexbes...@math.uni-muenster.de: Gary Jennejohn schrieb am 2009-10-23: On Fri, 23 Oct 2009 12:58:43 +0400 pluknet pluk...@gmail.com wrote: 2009/10/23 Antony Mawer li...@mawer.org: On Fri, Oct 23, 2009 at 1:35 PM, Alexander Best alexbes...@math.uni-muenster.de 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. I am wondering if this has anything to do with the new tty subsystem in 8.0, as this wasn't a problem I've experienced before under 7.x... No, that's a regression appeared in (FreeBSD'ish? version of) ee 1.5.0. SIGWINCH is handled in new_curse.c, but it's not being compiled/linked. --- Gary Jennejohn i think that file is only used on systems which have termio.h/sgtty.h and ee doesn't get linked against ncurses. on those systems (linux e.g.) new_curse.c is used to handle certain things which ncurses takes care under freebsd. this is under freebsd: `make`: Neither termio.h or sgtty.h are on this system! Relying on local curses implementation. Generating make.local make -f make.local cc ee.c -o ee -ggdb -DDIAG -DHAS_UNISTD -DHAS_STDARG -DHAS_STDLIB -DHAS_CTYPE -DHAS_SYS_IOCTL -DHAS_SYS_WAIT -DSLCT_HDR -DTERMCAP=\/usr/share/misc/termcap\ -lcursesw `ldd ee`: libncursesw.so.8 = /lib/libncursesw.so.8 (0x2809b000) libc.so.7 = /lib/libc.so.7 (0x280e9000) [Probably already mentioned.] btw, ee compiled under fbsd with new_curse.c (and not linked with curses/cursesw) goes fine with SIGWINCH. --- Makefile.old2009-10-23 16:13:45.0 +0400 +++ Makefile2009-10-23 16:30:03.0 +0400 @@ -3,15 +3,14 @@ .PATH: ${.CURDIR}/../../contrib/ee CFLAGS+= -DHAS_NCURSES -DHAS_UNISTD -DHAS_STDARG -DHAS_STDLIB \ --DHAS_SYS_WAIT +-DHAS_SYS_WAIT -DCAP -DNCURSE PROG= ee +SRCS= ee.c new_curse.c LINKS= ${BINDIR}/ee ${BINDIR}/ree ${BINDIR}/ee ${BINDIR}/edit MLINKS=ee.1 ree.1 ee.1 edit.1 -DPADD= ${LIBNCURSES} -LDADD= -lncurses -WARNS?=2 +WARNS?=0 NLS= en_US.US-ASCII fr_FR.ISO8859-1 de_DE.ISO8859-1 pl_PL.ISO8859-2 \ uk_UA.KOI8-U ru_RU.KOI8-R hu_HU.ISO8859-2 $ ldd ./ee ./ee: libc.so.6 = /lib/libc.so.6 (0x2808a000) (yes, it's FreeBSD 6.x). won't work under CURRENT i'm afraid: Warning: Object directory not changed from original /usr/src/usr.bin/ee cc -O2 -fno-strict-aliasing -pipe -march=native -DHAS_NCURSES -DHAS_UNISTD -DHAS_STDARG -DHAS_STDLIB -DHAS_SYS_WAIT -DCAP -DNCURSE -std=gnu99 -fstack-protector -Wno-pointer-sign -c /usr/src/usr.bin/ee/../../contrib/ee/ee.c In file included from /usr/src/usr.bin/ee/../../contrib/ee/ee.c:68: /usr/src/usr.bin/ee/../../contrib/ee/new_curse.h:47:19: error: sgtty.h: No such file or directory *** Error code 1 Stop in /usr/src/usr.bin/ee. here's the entry in ObsoleteFiles.inc: # 20080725: sgtty.h removed OLD_FILES+=usr/include/sgtty.h alex ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org
Re: help needed to fix contrib/ee crash/exit when receiving SIGWINCH
2009/10/23 Alexander Best alexbes...@math.uni-muenster.de: pluknet schrieb am 2009-10-23: 2009/10/23 Alexander Best alexbes...@math.uni-muenster.de: Gary Jennejohn schrieb am 2009-10-23: On Fri, 23 Oct 2009 12:58:43 +0400 pluknet pluk...@gmail.com wrote: 2009/10/23 Antony Mawer li...@mawer.org: On Fri, Oct 23, 2009 at 1:35 PM, Alexander Best alexbes...@math.uni-muenster.de 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. I am wondering if this has anything to do with the new tty subsystem in 8.0, as this wasn't a problem I've experienced before under 7.x... No, that's a regression appeared in (FreeBSD'ish? version of) ee 1.5.0. SIGWINCH is handled in new_curse.c, but it's not being compiled/linked. --- Gary Jennejohn i think that file is only used on systems which have termio.h/sgtty.h and ee doesn't get linked against ncurses. on those systems (linux e.g.) new_curse.c is used to handle certain things which ncurses takes care under freebsd. this is under freebsd: `make`: Neither termio.h or sgtty.h are on this system! Relying on local curses implementation. Generating make.local make -f make.local cc ee.c -o ee -ggdb -DDIAG -DHAS_UNISTD -DHAS_STDARG -DHAS_STDLIB -DHAS_CTYPE -DHAS_SYS_IOCTL -DHAS_SYS_WAIT -DSLCT_HDR -DTERMCAP=\/usr/share/misc/termcap\ -lcursesw `ldd ee`: libncursesw.so.8 = /lib/libncursesw.so.8 (0x2809b000) libc.so.7 = /lib/libc.so.7 (0x280e9000) [Probably already mentioned.] btw, ee compiled under fbsd with new_curse.c (and not linked with curses/cursesw) goes fine with SIGWINCH. --- Makefile.old 2009-10-23 16:13:45.0 +0400 +++ Makefile 2009-10-23 16:30:03.0 +0400 @@ -3,15 +3,14 @@ .PATH: ${.CURDIR}/../../contrib/ee CFLAGS+= -DHAS_NCURSES -DHAS_UNISTD -DHAS_STDARG -DHAS_STDLIB \ - -DHAS_SYS_WAIT + -DHAS_SYS_WAIT -DCAP -DNCURSE PROG= ee +SRCS= ee.c new_curse.c LINKS= ${BINDIR}/ee ${BINDIR}/ree ${BINDIR}/ee ${BINDIR}/edit MLINKS= ee.1 ree.1 ee.1 edit.1 -DPADD= ${LIBNCURSES} -LDADD= -lncurses -WARNS?= 2 +WARNS?= 0 NLS= en_US.US-ASCII fr_FR.ISO8859-1 de_DE.ISO8859-1 pl_PL.ISO8859-2 \ uk_UA.KOI8-U ru_RU.KOI8-R hu_HU.ISO8859-2 $ ldd ./ee ./ee: libc.so.6 = /lib/libc.so.6 (0x2808a000) (yes, it's FreeBSD 6.x). won't work under CURRENT i'm afraid: Warning: Object directory not changed from original /usr/src/usr.bin/ee cc -O2 -fno-strict-aliasing -pipe -march=native -DHAS_NCURSES -DHAS_UNISTD -DHAS_STDARG -DHAS_STDLIB -DHAS_SYS_WAIT -DCAP -DNCURSE -std=gnu99 -fstack-protector -Wno-pointer-sign -c /usr/src/usr.bin/ee/../../contrib/ee/ee.c In file included from /usr/src/usr.bin/ee/../../contrib/ee/ee.c:68: /usr/src/usr.bin/ee/../../contrib/ee/new_curse.h:47:19: error: sgtty.h: No such file or directory *** Error code 1 Stop in /usr/src/usr.bin/ee. here's the entry in ObsoleteFiles.inc: # 20080725: sgtty.h removed OLD_FILES+=usr/include/sgtty.h alex Ah, OK. Just a stupid and not-tested guess. -- wbr, pluknet ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org
Re: help needed to fix contrib/ee crash/exit when receiving SIGWINCH
Gentlemen, good day. Fri, Oct 23, 2009 at 02:02:38PM +0200, Dag-Erling Sm??rgrav wrote: src/contrib/ee/ee.c in 8: in = wgetch(text_win); if (in == -1) exit(0); /* without this exit ee will go into an infinite loop if the network session detaches */ From the wgetch() man page: Programmers concerned about portability should be prepared for either of two cases: (a) signal receipt does not interrupt getch; (b) signal receipt interrupts getch and causes it to return ERR with errno set to EINTR. Under the ncurses implementation, handled signals never inter??? rupt getch. Hmm, we can transform this code to the following one: - errno = 0; do { in = wgetch(text_win); } while (errno == EINTR); if (in == -1) exit(0); - This won't help with FreeBSD's ncurses, but may be other variants will feel much better with such a event loop variant. 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. The problem should be healed with the attached patch. And you're partly right: this is kgetch() that is returning ERR for the second wgetch(), but kgetch() shouldn't be blamed for this -- _nc_wgetch() should. At least in my opinion ;) Any views on this? -- Eygene ____ _.--. # \`.|\.....-'` `-._.-'_.-'` # Remember that it is hard / ' ` , __.--' # to read the on-line manual )/' _/ \ `-_, /# while single-stepping the kernel. `-' `\_ ,_.-;_.-\_ ', fsc/as # _.-'_./ {_.' ; / #-- FreeBSD Developers handbook {_.-``-' {_/# From d0b09b188c778858f44379546bcce05e8a279fe0 Mon Sep 17 00:00:00 2001 From: Eygene Ryabinkin rea-f...@codelabs.ru Date: Fri, 23 Oct 2009 19:02:14 +0400 Subject: [PATCH] Ncurses: get ERR from the fifo when SIGWINCH is handled fifo_pull() will put ERR to the buffer if read() will fail for any reason. kgetch() will notice this ERR and won't interpret any fifo contents setting peek = head. But when _nc_wgetch() will handle SIGWINCH and KEY_RESIZE will be pushed into fifo and taken out, ERR will still stay there. We should take ERR from the fifo or kgetch() will return ERR on all subsequent calls. Signed-off-by: Eygene Ryabinkin rea-f...@codelabs.ru --- contrib/ncurses/ncurses/base/lib_getch.c |6 ++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/contrib/ncurses/ncurses/base/lib_getch.c b/contrib/ncurses/ncurses/base/lib_getch.c index a3812be..e7ba0b2 100644 --- a/contrib/ncurses/ncurses/base/lib_getch.c +++ b/contrib/ncurses/ncurses/base/lib_getch.c @@ -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); } } -- 1.6.4.4 ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org
Re: help needed to fix contrib/ee crash/exit when receiving SIGWINCH
Eygene Ryabinkin schrieb am 2009-10-23: Gentlemen, good day. Fri, Oct 23, 2009 at 02:02:38PM +0200, Dag-Erling Sm??rgrav wrote: src/contrib/ee/ee.c in 8: in = wgetch(text_win); if (in == -1) exit(0); /* without this exit ee will go into an infinite loop if the network session detaches */ From the wgetch() man page: Programmers concerned about portability should be prepared for either of two cases: (a) signal receipt does not interrupt getch; (b) signal receipt interrupts getch and causes it to return ERR with errno set to EINTR. Under the ncurses implementation, handled signals never inter??? rupt getch. Hmm, we can transform this code to the following one: - errno = 0; do { in = wgetch(text_win); } while (errno == EINTR); if (in == -1) exit(0); - This won't help with FreeBSD's ncurses, but may be other variants will feel much better with such a event loop variant. 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. The problem should be healed with the attached patch. And you're partly right: this is kgetch() that is returning ERR for the second wgetch(), but kgetch() shouldn't be blamed for this -- _nc_wgetch() should. At least in my opinion ;) Any views on this? thanks a million. for me the patch works great. :) the sooner it gets committed the better. ;) since this problem is not limited to freebsd it would be nice if somebody could send the patch to the ncurses maintainers so all OSes using ncurses can profit from it. cheers. alex ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org
Re: help needed to fix contrib/ee crash/exit when receiving SIGWINCH
Fri, Oct 23, 2009 at 06:32:38PM +0200, Alexander Best wrote: thanks a million. for me the patch works great. :) You're welcome ;)) the sooner it gets committed the better. ;) It may well break something else. I am not 100% sure that this patch is the proper thing -- curses code is a bit new to me, so I would say that the patch will need more thorough review from maintainers. since this problem is not limited to freebsd it would be nice if somebody could send the patch to the ncurses maintainers so all OSes using ncurses can profit from it. Will also send this patch to bug-ncur...@gnu.org. -- Eygene ____ _.--. # \`.|\.....-'` `-._.-'_.-'` # Remember that it is hard / ' ` , __.--' # to read the on-line manual )/' _/ \ `-_, /# while single-stepping the kernel. `-' `\_ ,_.-;_.-\_ ', fsc/as # _.-'_./ {_.' ; / #-- FreeBSD Developers handbook {_.-``-' {_/# ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org
Re: help needed to fix contrib/ee crash/exit when receiving SIGWINCH
Eygene Ryabinkin schrieb am 2009-10-23: Gentlemen, good day. Fri, Oct 23, 2009 at 02:02:38PM +0200, Dag-Erling Sm??rgrav wrote: src/contrib/ee/ee.c in 8: in = wgetch(text_win); if (in == -1) exit(0); /* without this exit ee will go into an infinite loop if the network session detaches */ From the wgetch() man page: Programmers concerned about portability should be prepared for either of two cases: (a) signal receipt does not interrupt getch; (b) signal receipt interrupts getch and causes it to return ERR with errno set to EINTR. Under the ncurses implementation, handled signals never inter??? rupt getch. Hmm, we can transform this code to the following one: - errno = 0; do { in = wgetch(text_win); } while (errno == EINTR); if (in == -1) exit(0); - This won't help with FreeBSD's ncurses, but may be other variants will feel much better with such a event loop variant. 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. The problem should be healed with the attached patch. And you're partly right: this is kgetch() that is returning ERR for the second wgetch(), but kgetch() shouldn't be blamed for this -- _nc_wgetch() should. At least in my opinion ;) Any views on this? oh...and btw. the PR (http://www.freebsd.org/cgi/query-pr.cgi?pr=bin/136223) hasn't been assigned to anyone yet. could the person who will be committing the patch please take care of that (maybe setting the PR to analysed-patched-closed? ;) would be great if this fix could make it into 8.0-RELEASE in time because it's quite nasty to lose all your editor data due to a SIGWINCH. cheers. alex ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org
Re: help needed to fix contrib/ee crash/exit when receiving SIGWINCH
* Eygene Ryabinkin rea-f...@codelabs.ru wrote: The problem should be healed with the attached patch. Ah, thanks. I looked at this some time ago but I also discovered ncurses was to blame. I didn't have any time to look at it back then, so I obviously forgot. Have you sent it to Thomas Dickey as well? -- Ed Schouten e...@80386.nl WWW: http://80386.nl/ pgpFmrxtywjnm.pgp Description: PGP signature
Re: help needed to fix contrib/ee crash/exit when receiving SIGWINCH
Ed, good day. Fri, Oct 23, 2009 at 07:13:01PM +0200, Ed Schouten wrote: Have you sent it to Thomas Dickey as well? Sent the patch to bug-ncur...@gnu.org. Do you think that I should send it to Thomas directly as well? -- Eygene ____ _.--. # \`.|\.....-'` `-._.-'_.-'` # Remember that it is hard / ' ` , __.--' # to read the on-line manual )/' _/ \ `-_, /# while single-stepping the kernel. `-' `\_ ,_.-;_.-\_ ', fsc/as # _.-'_./ {_.' ; / #-- FreeBSD Developers handbook {_.-``-' {_/# ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org
help needed to fix contrib/ee crash/exit when receiving SIGWINCH
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). unfortunately we were unable to find the problem. it seems to be related to ncurses. running the ee linux binary under freebsd causes no problem with SIGWINCH at all. since the linux binary doesn't need to be linked against ncurses (linux has termio.h/sgtty.h) we assume the problem is related to ncurses. right at the beginning of the ee code all signals get set to SIG_IGN: for (counter = 1; counter = 32; counter++) signal(counter, SIG_IGN); so actually SIGWINCH shouldn't cause any problems since it gets discarded. looking through the src i'm quite sure that SIGWINCH stays set to SIG_IGN the whole time. yet running ee with truss shows this result when doing `grep WINCH`: sigprocmask(SIG_BLOCK,SIGHUP|SIGINT|SIGQUIT|SIGKILL|SIGPIPE|SIGALRM|SIGTERM|SIGURG|SIGSTOP|SIGTSTP|SIGCONT|SIGCHLD|SIGTTIN|SIGTTOU|SIGIO|SIGXCPU|SIGXFSZ|SIGVTALRM|SIGPROF|SIGWINCH|SIGINFO|SIGUSR1|SIGUSR2,0x0) = 0 (0x0) sigprocmask(SIG_BLOCK,SIGHUP|SIGINT|SIGQUIT|SIGKILL|SIGPIPE|SIGALRM|SIGTERM|SIGURG|SIGSTOP|SIGTSTP|SIGCONT|SIGCHLD|SIGTTIN|SIGTTOU|SIGIO|SIGXCPU|SIGXFSZ|SIGVTALRM|SIGPROF|SIGWINCH|SIGINFO|SIGUSR1|SIGUSR2,0x0) = 0 (0x0) sigprocmask(SIG_BLOCK,SIGHUP|SIGINT|SIGQUIT|SIGKILL|SIGPIPE|SIGALRM|SIGTERM|SIGURG|SIGSTOP|SIGTSTP|SIGCONT|SIGCHLD|SIGTTIN|SIGTTOU|SIGIO|SIGXCPU|SIGXFSZ|SIGVTALRM|SIGPROF|SIGWINCH|SIGINFO|SIGUSR1|SIGUSR2,0x0) = 0 (0x0) sigaction(SIGWINCH,{ SIG_IGN SA_RESTART ss_t },{ SIG_DFL 0x0 ss_t }) = 0 (0x0) sigaction(SIGWINCH,0x0,{ SIG_IGN SA_RESTART ss_t }) = 0 (0x0) sigaction(SIGWINCH,{ 0x280bc130 0x0 ss_t },0x0) = 0 (0x0) sigprocmask(SIG_BLOCK,SIGHUP|SIGINT|SIGQUIT|SIGKILL|SIGPIPE|SIGALRM|SIGTERM|SIGURG|SIGSTOP|SIGTSTP|SIGCONT|SIGCHLD|SIGTTIN|SIGTTOU|SIGIO|SIGXCPU|SIGXFSZ|SIGVTALRM|SIGPROF|SIGWINCH|SIGINFO|SIGUSR1|SIGUSR2,0x0) = 0 (0x0) sigprocmask(SIG_BLOCK,SIGHUP|SIGINT|SIGQUIT|SIGKILL|SIGPIPE|SIGALRM|SIGTERM|SIGURG|SIGSTOP|SIGTSTP|SIGCONT|SIGCHLD|SIGTTIN|SIGTTOU|SIGIO|SIGXCPU|SIGXFSZ|SIGVTALRM|SIGPROF|SIGWINCH|SIGINFO|SIGUSR1|SIGUSR2,0x0) = 0 (0x0) sigprocmask(SIG_BLOCK,SIGHUP|SIGINT|SIGQUIT|SIGKILL|SIGPIPE|SIGALRM|SIGTERM|SIGURG|SIGSTOP|SIGTSTP|SIGCONT|SIGCHLD|SIGTTIN|SIGTTOU|SIGIO|SIGXCPU|SIGXFSZ|SIGVTALRM|SIGPROF|SIGWINCH|SIGINFO|SIGUSR1|SIGUSR2,0x0) = 0 (0x0) so SIGWINCH doesn't stay set to SIG_IGN the whole time. it seems the problem is being caused by some ncurses function which gets called in contrib/ee/ee.c. contrib/ee/new_curse* aren't used since ee relies in freebsd's local ncurse implementation. it would be really great if this nasty bug could be fixed. you'll find a problem report here: http://www.freebsd.org/cgi/query-pr.cgi?pr=bin/136223 please don't hesitate to ask for more details. cheers. alex ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org
Re: help needed to fix contrib/ee crash/exit when receiving SIGWINCH
On Fri, Oct 23, 2009 at 1:35 PM, Alexander Best alexbes...@math.uni-muenster.de 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. I am wondering if this has anything to do with the new tty subsystem in 8.0, as this wasn't a problem I've experienced before under 7.x... Maybe worth cc'ing ed@ to see if he has any thoughts? --Antony ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org
Re: help needed to fix contrib/ee crash/exit when receiving SIGWINCH
On Fri, 23 Oct 2009, Antony Mawer wrote: On Fri, Oct 23, 2009 at 1:35 PM, Alexander Best alexbes...@math.uni-muenster.de 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 n...@thatsmathematics.com ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org
Re: help needed to fix contrib/ee crash/exit when receiving SIGWINCH
Antony Mawer skrev: On Fri, Oct 23, 2009 at 1:35 PM, Alexander Best alexbes...@math.uni-muenster.de 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. I am wondering if this has anything to do with the new tty subsystem in 8.0, as this wasn't a problem I've experienced before under 7.x... I've been using ee in Mac OSX for a while and I see the exact same behaviour, ee exits when I resize the terminal window. I haven't seen it in FreeBSD yet, but that is probably because I don't use Xorg on any of my FreeBSD systems... -- Joel ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org