Re: Segfault on ctrl-C (curpos)
Benno Schulenberg <[email protected]>
| Newsgroups | gmane.editors.nano.general |
|---|---|
| Message-ID | <1482234130.1231693.824674889.3E5EA326@webmail.messagingengine.com> |
Hello Liam, Thanks for reporting! On Tue, Dec 20, 2016, at 09:21, Liam Gretton wrote: > I build Nano for our SLES and CentOS systems. For quite a few versions > including 2.7.2 my SLES builds segfault if ctrl-C (curpos) is used. > > I've finally got round to rebuilding with debugging enabled and the > following is reported when ctrl-C is pressed (new Nano session, nothing > in the buffer): > > get_key_buffer(): the sequence of hex codes: 163 > before parsing: keycode = 355, escapes = 0, byte_digits = 0 > whoops, returning null given func 4270736 in menu 1 > Segmentation fault Please try the attached patch. It fixes it for me. > The error therefore suggests Cancel is being called out of context > instead of curpos. > > Any ideas what might be wrong? Your keyboard/input-system produces an actual KEY_CANCEL code when you press ^C, instead of simply 0x03, what most other systems seem to do. Do you compile ncurses in a special way on SLES to make it report ^C as KEY_CANCEL? > Nanorc: > > set backup > set const > set cut Wow. You actually use 'set cut'? Not being used to it, I find that behavior quite confusing. (I've tried running for a moment with your config. :) ) You may wish to update "const" to "constantshow" -- its new name. Benno -- http://www.fastmail.com - The professional email service _______________________________________________ Help-nano mailing list [email protected] https://lists.gnu.org/mailman/listinfo/help-nano
try-the-control-c-code-instead.patch
(text/x-diff, 374 B)
diff --git a/src/winio.c b/src/winio.c index 7237b8ac..8a5d70a3 100644 --- a/src/winio.c +++ b/src/winio.c @@ -667,7 +667,7 @@ int parse_kbinput(WINDOW *win) #endif /* Slang doesn't support KEY_CANCEL. */ case KEY_CANCEL: - return first_sc_for(currmenu, do_cancel)->keycode; + return sc_seq_or(do_cancel, 0x03); #endif #ifdef KEY_SUSPEND #ifdef KEY_SSUSPEND